Browser Check

This script checks which browser version the visitor is using and assigns a name to it.  You can then create different expressions which define the criteria for directing customers to the correct page, running certain functions, or allowing/disallowing specific features. This script is particularly useful for sites with multiple versions or sites with advanced features that may crash older browsers. Click the following button for a quick check on your browser.  


<script language="JavaScript">
<!--
bName = navigator.appName;
bVer = parseInt(navigator.appVersion);

if (bName == "Netscape" && bVer == 2) ver = "n2";
else if (bName == "Netscape" && bVer == 3) ver = "n3";
else if (bName == "Netscape" && bVer == 4) ver = "n4";
else if (bName == "Microsoft Internet Explorer" && bVer < 2) ver = "n2";
else if (bName == "Microsoft Internet Explorer" && bVer ==2) ver = "n3";
else if (bName == "Microsoft Internet Explorer" && bVer > 2) ver = "n4";
if (ver != "n2") {
your_function_here( )
} else {
alert("No way Jose!")
}
//-->
</script>


  • The appVersions listed above cannot be changed.  You shouldn't alter any of the purple text above unless you want to generalize more than 1 version ( e.g., "Netscape" && bVer <4) ver = "old"; represents versions 2 and 3)
  • The if / else statements may changed at your discretion to suit your needs.
  • You can use different equality checks for more control. The valid conditional operators are:
    equal (==), not equal (!=), greater than (>), less than (<),
    greater than or equal (>=), and less than or equal (<=)

Back to Web Tips