DHTML Forum  

Go Back   DHTML Forum > dhtmlcentral.com > Crossbrowser DHTML
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 15.10.2003, 12:22
mjance mjance is offline
Neuer Benutzer
 
Join Date: 15.10.2003
Location:
Posts: 1
Default

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!








Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT +2. The time now is 04:47.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.