Welcome to WebmasterWorld Guest from 3.233.226.151

Forum Moderators: open

Message Too Old, No Replies

redirecting your site

redirect the site using JavaScript!

     
7:30 am on Jan 8, 2004 (gmt 0)

New User

10+ Year Member

joined:Jan 3, 2004
posts:40
votes: 0


hey all,
It may look simple to JS gurus, but I am having helluva hard time figuring out why the following code doesn't work. It's simple. I just want to redirect users to the appropriate page depending on their browsers. May be I am missing something here. Help me please. Here is the JS code with simple HTML code.

<html>

<head>

<title> Index Page </title>

<script language="javascript">
<!-- hide me

var browser_name == navigator.appName;
var version = parseFloat(navigator.appVersion)

if (browser_name == "Netscape")
{
window.location = "mainpagenetscape.html";
}

else if (browser_name == "Microsoft Internet Explorer")
{
window.location = "mainpage.html";
}

// show me -->
</script>
</head>

<body>
blah, blah, blah, blah

</body>
</html>

Thanks in advance
luckydude

8:11 am on Jan 8, 2004 (gmt 0)

New User

10+ Year Member

joined:Jan 8, 2004
posts:23
votes: 0


Change this:

var browser_name == navigator.appName;

to this:

var browser_name = navigator.appName;

:)

You probably know this, but jic:
== is a boolean check
= sets a varaible

8:27 am on Jan 8, 2004 (gmt 0)

New User

10+ Year Member

joined:Jan 3, 2004
posts:40
votes: 0


yeah, that's right. I forgot about it. But it still doesn't work ;..() help me :-<()

Thanks in advance
luckydude

8:34 am on Jan 8, 2004 (gmt 0)

New User

10+ Year Member

joined:Jan 3, 2004
posts:40
votes: 0


Never mind. It worked :). Thanks a million for your help.

luckydude