Today, there are more and more browsers, but the compatibility is not flattering. This script can be automatically navigated Based on the browser, which is very useful in specific scenarios. You can take a look !!!
Copy codeThe Code is as follows:
<SCRIPT language = "JavaScript">
<! --
Function browserSniffer (netscape4URL, explorer4URL, webtvURL,
AolURL, operaURL, version3URL, w3cURL ){
Var agt = navigator. userAgent. toLowerCase ();
Var agt = navigator. userAgent. toLowerCase ();
Var is_major = parseInt (navigator. appVersion );
Var is_minor = parseFloat (navigator. appVersion );
Var is_nav = (agt. indexOf ('mozilla ')! =-1) & (agt. indexOf ('spoofer ') =-1)
& (Agt. indexOf ('compute') =-1) & (agt. indexOf ('Opera ') =-1)
& (Agt. indexOf ('webtv') =-1 ));
Var is_nav2 = (is_nav & (is_major = 2 ));
Var is_nav3 = (is_nav & (is_major = 3 ));
Var is_nav4 = (is_nav & (is_major = 4 ));
Var is_nav4up = (is_nav & (is_major> = 4 ));
Var is_navonly = (is_nav & (agt. indexOf ("; nav ")! =-1) |
(Agt. indexOf ("; nav ")! =-1 )));
Var is_nav5 = (is_nav & (is_major = 5 ));
Var is_nav5up = (is_nav & (is_major> = 5 ));
Var is_ie = (agt. indexOf ("msie ")! =-1 );
Var is_ie3 = (is_ie & (is_major <4 ));
Var is_ie4 = (is_ie & (is_major = 4) & (agt. indexOf ("msie 5.0") =-1 ));
Var is_ie4up = (is_ie & (is_major> = 4 ));
Var is_ie5 = (is_ie & (is_major = 4) & (agt. indexOf ("msie 5.0 ")! =-1 ));
Var is_ie5up = (is_ie &&! Is_ie3 &&! Is_ie4 );
Var is_aol = (agt. indexOf ("aol ")! =-1 );
Var is_aol3 = (is_aol & is_ie3 );
Var is_aol4 = (is_aol & is_ie4 );
Var is_opera = (agt. indexOf ("opera ")! =-1 );
Var is_webtv = (agt. indexOf ("webtv ")! =-1 );
If (is_nav4up ){
Location. href = netscape4URL; // netscape 4 + but not NS5
} Else if (is_ie4up) {// IE4 & IE5 but returns IE4
Location. href = assumer4url;
} Else if (is_webtv) {// Web TV
Location. href = webtvURL;
} Else if (is_aol | is_aol3 | is_aol4) {// AOL
Location. href = aolURL;
} Else if (is_opera) {// Opera
Location. href = operaURL;
} Else if (is_ie3 | is_nav3) {// 3.0 version browsers
Location. href = version3URL;
} Else if (is_nav5up) {// Netscape 5
Location. href = w3cURL;
}
}
// -->
</SCRIPT>
<BODY>