![]() |
|
#1
|
|||
|
|||
|
I'm trying to get this DHTML browser detection redirection script to work for
MSIE browsers >= 6 and Netscape Browsers >= 6. I am using MSIE 6 and Netscape 7.1 to test these scripts under these conditions. This is the original script, which is to be placed in the head section of the html document: <script> //Browser redirect Script- Dynamic Drive (www.dynamicdrive.com) //For full source code, 100's more DHTML scripts, and Terms Of Use, //visit dynamicdrive.com var browser_type=navigator.appName var browser_version=parseInt(navigator.appVersion) //if NS 6 if (browser_type=="Netscape"&&browser_version>=5) window.location.replace("http://mozilla.org") //if IE 4+ else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4) window.location.replace("http://microsoft.com") //if NS4+ else if (browser_type=="Netscape"&&browser_version>=4) window.location.replace("http://www.netscape.com") //Default goto page (NOT NS 4+ and NOT IE 4+) else window.location="http://www.dynamicdrive.com" </script> This actually works. But when I change it to this... <script> //Browser redirect Script- Dynamic Drive (www.dynamicdrive.com) //For full source code, 100's more DHTML scripts, and Terms Of Use, //visit dynamicdrive.com var browser_type=navigator.appName var browser_version=parseInt(navigator.appVersion) //if NS 6 if (browser_type=="Netscape"&&browser_version>=6) // Changed from >=5 to >= 6 window.location.replace("http://mozilla.org") //if IE 4+ else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=6) // Changed from >=4 to >=6 window.location.replace("http://microsoft.com") //if NS4+ else if (browser_type=="Netscape"&&browser_version>=4) window.location.replace("http://www.netscape.com") //Default goto page (NOT NS 4+ and NOT IE 4+) else window.location="http://www.dynamicdrive.com" </script> ... the first test condition goes to www.netscape.com (not mozilla.org) and the second test condition goes to the last condition (dynamicdrive.com) Am I doing something wrong here? How do I get Netscape browsers >=6 and MSIE browsers >= 6 to go to the specified locations? Thanks! |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|