The Window.navigator object contains information about the visitor's browser. Window Navigator
The Window.navigator object does not use the prefix of window when writing. instance
<div id= "Example" ></div>
<script>
txt = "<p>browser codename:" + Navigator.appcodename + "</p>";
txt+= "<p>browser Name:" + navigator.appname + "</p>";
txt+= "<p>browser Version:" + navigator.appversion + "</p>";
txt+= "<p>cookies Enabled:" + navigator.cookieenabled + "</p>";
txt+= "<p>platform:" + navigator.platform + "</p>";
txt+= "<p>user-agent Header:" + navigator.useragent + "</p>";
txt+= "<p>user-agent language:" + navigator.systemlanguage + "</p>";
document.getElementById ("Example"). Innerhtml=txt;
</script>
Warning: The information from the Navigator object is misleading and should not be used to detect browser versions because: Navigator data can be changed by the browser Consumer browser can not report later than the browser published new operating system browser detection
Because navigator can mislead browser detection, object detection can be used to sniff different browsers.
Because different browsers support different objects, you can use objects to detect browsers. For example, because only opera supports the attribute "Window.opera", you can identify opera accordingly.
Example: if (Window.opera) {... some action ...}