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 the window. The javascript navigator object is the window property which is used for browser detection and to get browser information. It is a property of the window object and thus can be written as window.navigator or only navigator.

 Properties of Navigator Object:

PROPERTY USES
appName To get the application name of the browser.
appVersion To get the application version of the browser.
appCodeName To get the application code name of the browser.
cookieEnabled To get a true value if the cookie is already enabled otherwise false.
language To get the language (This property is supported in Netscape and Firefox only).
mimeTypes To get the array of mime type (This property is supported in Netscape and Firefox only).
online To get a true value if a browser is online otherwise false.
platform To get the platform or OS of the browser.
plugins To get the plugins (This property is supported in Netscape and Firefox only).
systemLanguage To get the system language (This property is supported in IE only).
userAgent To get the user agent header sent by the browser to the server.
userLanguage To get the user language (This property is supported in IE only).

 

Methods of Navigator Object:

METHOD USES
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>