[Home]How do I detect what browser is being used

HomePage | RecentChanges | Preferences | Newbie Help

Bodidily offers --

<SCRIPT LANGUAGE = "JavaScript" type="text/javascript"><!--

var r
browser = navigator.appName

version="4.0 (compatible; MSIE 4.0b1; Windows 95)"
if (browser == "Microsoft Internet Explorer" &&
navigator.appVersion==version)

<!-- If Browser is MSIE 4.0b1 go to MSIE Page-->
parent.location.href="msiepage.html"
r=2
}

else {
ua="Mozilla/2.0 (compatible; MSIE 3.02; Windows 95)"
if (navigator.userAgent==ua){
<!-- If Browser is MSIE 3.02 go to MSIE Page.-->
parent.location.href="msiepage.html"
r=2
}

version="4.0 (compatible; MSIE 4.0b2; Windows 95)"
if (browser == "Microsoft Internet Explorer" &&
navigator.appVersion==version)

<!-- Browser is MSIE 4.0b2 go to MSIE Page.-->
parent.location.href="msiepage.html"
r=2
}

version="2.01 (Win95; I)"
if (navigator.appVersion==version && navigator.appCodeName=="Mozilla")

<!-- Browser is Netscape 2.01 go to Netscape page.-->
parent.location.href="nspage.html"
r=1
}

version="2.0 (Win95; I; 16bit)"
if (navigator.appVersion==version && navigator.appCodeName=="Mozilla")

<!-- Browser is Netscape 2.0 16 bit go to Netscape page.-->
parent.location.href="nspage.html"
r=1
}

version="4.01 [en] (Win95; I)"
if (navigator.appVersion==version && navigator.appCodeName=="Mozilla")

<!-- If Browser is Netscape 4.01 go to Netscape page.-->
parent.location.href="nspage.html"
r=1
}

version="3.0 (Win95; I)"
if (browser == "Netscape" && navigator.appVersion==version)

<!-- If browser is Netscape 3.0 for Win95 go to Netscape Page.-->
parent.location.href="nspage.html"
r=1
 }
}

if (browser=="Netscape") {
<!-- If browser is Netscape and Supports JavaScript go to Netscape Page-->
parent.location.href="nspage.html"
r=1
}

if (r !=1 && r

// if browser is not Nestcape or MSIE known versions go to MSIE page.
<!--(caters for any other JavaScript Browsers).-->
parent.location.href="msiepage.html"
}

// -->
</SCRIPT>


Comments --


HomePage | RecentChanges | Preferences | Newbie Help
This page is read-only | View other revisions
Last edited August 17, 2001 2:00 pm (diff)
Search:

This FAQ is happily hosted by Betadome Digital Media