Jump to content

Browsers


jarrett000

Recommended Posts

This is kind of a noob script cause I just finished the JS lessons and am still studying the more advanced and all areas of DOM, but what I want to do is that if the browser isn't netscape (which for some reason is forefox) at the newst version, a redirection should occur. This is my script so far:

function SendUser(){var A=navigator.appName;var B=navigator.appVersion;if ((!A=="Netscape") && (!B>2))  {  top.location="http://www.mozilla.com/en-US/firefox/firefox.html";  }}

But it dosen't work and I don't know why.

Link to comment
Share on other sites

You might be better off using IE's conditional comments for something like this.

<html><body><!--[if IE]><script type="text/javascript">location.href = "http://www.w3schools.com/";</script><![endif]-->Hi non-IE user!</body></html>

Link to comment
Share on other sites

Also, these aren't going to do what you want:if ((!A=="Netscape") && (!B>2))That the same as this:if (( (!A) == "Netscape" ) && ( (!:) > 2))The expression (!A) is probably going to evaluate to false, so that line is the same as this:if (( false == "Netscape" ) && ( false > 2))

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...