Get browser type by using the navigator.userAgent : userAgent : Navigator JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Navigator » userAgent »

 

Get browser type by using the navigator.userAgent

















<html>
<head>
<script language="JavaScript" type = "text/javascript">
<!--
var bname = "browser";
if (navigator.userAgent.indexOf("MSIE"!= -1)
{
 bname = "Internet Explorer";
}
else if (navigator.userAgent.indexOf("Opera"!= -1)
{
 bname = "Opera";
}
else if ((navigator.appName.indexOf("Netscape"!= -1|| parseFloat(navigator.appVersion >= 3.0))
{
 bname = "Netscape Navigator";
}
else
{
 bname = "Unknown Browser";
}
document.write("Your browser is: " + bname);
//-->
</script>
<title>Display Browser Information</title>
</head>
<body>
</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Navigator
» userAgent