Click to See Complete Forum and Search --> : redirect to netscape freindly page


tcjay
03-22-2003, 03:41 AM
I would like to redirect netscape versions 1 through 4 to one page and everyone else to another page. I found this script on this page and loaded it into the body of the index page.

This is the script:

<script>
<!-- Begin

var name = navigator.appName;
var vers = navigator.appVersion;
vers = vers.substring(0,4); // or 0,4 could return 4.5 instead of just 4

if (name == "Microsoft Internet Explorer")
url="/html/index.php";
else
url="netscape";
url += vers + ".htm";
window.location=/html/index.htm;
//document.write('<center>');
//document.write('<A HREF="' + url + '">Enter</A>');
//document.write('</center>');

// You may make the redirection automatic by using this
// window.location=url;
// instead of the three document.write lines above

// End -->
</script>

I changed two lines. I added the url line for internet explorer;url="/html/index.php";

and the url for the netscape page
window.location=/html/index.htm;

Did I enter the urls in the right place?

The webpage is www.yorkieparadise.com
The netscape page I would like to load is www.yorkieparadise.com/html/yorkieparadise.com and for all others I would like to load is www.yorkieparadise.com/html/index.php

Thank you for your help.

Tom

:)

khalidali63
03-22-2003, 07:31 AM
The obvious error I could see is in this line

window.location=/html/index.htm;

should be like this

window.location.href="/html/index.htm";


Cheers

Khalid

gil davis
03-22-2003, 07:33 AM
<script>
if (navigator.appName == "Netscape")
{window.location.href = "html/yorkieparadise.htm";}
else
{if (navigator.appName == "Microsoft Internet Explorer")
{window.location.href = "html/index.php";}
else
{//you should have another choice
}
}
</script>

tcjay
03-22-2003, 10:53 AM
I placed the code in the index file and loaded it up on the server and it does not work :(. No redirection ever occurs. Can you take a look to see what I am doing wrong. www.yorkieparadise.com . This is the code. The code is in the body of the document. TIA Tom

<script>
if (navigator.appName == "Netscape")
{window.location.href = "html/yorkieparadise.htm";}
else
{if (navigator.appName == "Microsoft Internet Explorer")
{window.location.href = "html/index.php";}
else
{window.location.href = "html/index.php";
}
</script>