Javascript Navigator object

Navigator object

Window is not an object of javascript; but all the JavaScript objects, functions, and variables are a property of the window object. There are various other objects of javascript that are considered as a property of window. The javascript navigator object is the window property which is used for browser detection and to get browser informations. It is a property of window object and thus can be written as window.navigator or only navigator.

 

Properties of Navigator Object:

PROPERTYUSES
appNameTo get the application name of the browser.
appVersionTo get the application version of the browser.
appCodeNameTo get the application code name of the browser.
cookieEnabledTo get a true value if cookie is already enabled otherwise false.
languageTo get the language (This property is supported in Netscape and Firefox only).
mimeTypesTo get the array of mime type (This property is supported in Netscape and Firefox only).
onlineTo get a true value true if browser is online otherwise false.
platformTo get the platform or OS of the browser.
pluginsTo get the plugins (This property is supported in Netscape and Firefox only).
systemLanguageTo get the system language (This property is supported in IE only).
userAgentTo get the user agent header sent by the browser to the server.
userLanguageTo get the user language (This property is supported in IE only).

 

Methods of Navigator Object:

METHODUSES
javaEnabled()To check if java is enabled.
taintEnabled()To check if taint is enabled.

 

Example:

<!DOCTYPE html>
<html>
<body>
 
<p id="navigator1"></p>
<p id="navigator2"></p>
<p id="navigator3"></p>
<p id="navigator4"></p>
<p id="navigator5"></p>
 
<script>
document.getElementById("navigator1").innerHTML =
"navigator.appName is " + navigator.appName;
document.getElementById("navigator2").innerHTML = 
"navigator.appVersion is " + navigator.appVersion;
document.getElementById("navigator3").innerHTML =
"navigator.platform is " + navigator.platform;
document.getElementById("navigator4").innerHTML =
"navigator.language is " + navigator.language;
document.getElementById("navigator5").innerHTML = 
"navigator.javaEnabled is " + navigator.javaEnabled();
</script>
 
</body>
</html>
Content Protection by DMCA.com
Please Share