Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1231 How can I redirect the user to different start pages if there are two domain names pointing to the same web?

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>

Feedback on 'Q1231 How can I redirect the user to different start pages if there are two domain names pointing to the same web?'

©2018 Martin Webb