Navigator Object
The JavaScript Navigator object contains relevant information about the browser.
Tip: Although there is no clear relevant standard for the Navigator object, all browsers support this object.
window.navigator object can be written without using the window prefix.
<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 Browser user changes
Some browsers will recognize errors for test sites
The browser cannot report new operating systems released later than the browser
Navigator object Methods
The Navigator object has the following two methods:
navigator.javaEnabled(): detects whether the browser has enabled java support and returns a Boolean value, true indicating support.
navigator.taintEnabled(): Detects whether the browser enables data tainting (data tainting), returns a Boolean value, true means enabled.