You are here: irt.org | FAQ | JavaScript | Redirect | Q1231 [ previous next ]
In index.html on the server have:
<html> <head> <title>Redirection...</title> <script language="JavaScript"><!-- var loc = window.location.href; var server1 = 'fox.com'; var server2 = 'fox.org'; var newLoc = 'error.html'; if (loc.toLowerCase().indexOf(server1) !=-1) newLoc = 'foxcom.html'; else if (loc.toLowerCase().indexOf(server2) !=-1) newLoc = 'foxorg.html'; document.write('Please stand by, redirecting to another page'); /* Use setTimeout to allow the user to use the back button */ if (document.images) setTimeout('window.location.replace(newLoc)',2000); else setTimeout('window.location = newLoc',2000); //--></script> </head> <body> You will be redirected in a few seconds. If not, please click one of the following: <a href="domain1.htm">www.domain1.com</a> <a href="domain2.htm">www.domain2.com</a> </body> </html>