Use userAgent to get the browser type : navigator « Javascript Objects « JavaScript DHTML






Use userAgent to get the browser type

  



<html>
<head>
  
</head>
<body>
<script type="text/javascript">

var browserType = navigator.userAgent.toLowerCase();

if(browserType.indexOf('mozilla')){
  document.write("Netscape Navigator");
}else if (browserType.indexOf('msie')){
  document.write("Microsoft Internet Explorer");
}else if (browserType.indexOf('opera')){
  document.write("Opera");
}else if (browserType.indexOf('webtv')){
  document.write("Web TV");
}

document.close()
</script>
</body>
</html>

   
    
  








Related examples in the same category

1.Get browser Language
2.Language information from Navigator
3.Get application Name
4.Application Code Name
5.Is onLine
6.Get platform information
7.Get cpu Class
8.Is Java enabled
9.Get applicatoin Version
10.Get application Minor Version (navigator.appMinorVersion)
11.Get system Language from navigator (navigator.systemLanguage)
12.Is navigator taint Enabled (navigator.taintEnabled())
13.Get user Agent from navigator (navigator.userAgent)
14.Get user Language from navigator object (navigator.userLanguage)
15.Get application name from navigator (navigator.appName)
16.List all plugins
17.Get the browser version through navigator.appVersion
18.Open Window based on user defined attributes
19.navigator.mimeTypes[1].description
20.navigator.mimeTypes[1].type
21.navigator.plugins[3].description
22.navigator.userAgent
23.navigator.appName
24.navigator.appCodeName
25.navigator.appVersion
26.navigator.appMinorVersion
27.navigator.platform
28.navigator.cookieEnabled
29.navigator.onLine
30.navigator.userLanguage
31.Display all values in navigator object