JS navigation object

The JavaScript navigator object provides information about the browser and the user's environment. It is part of the window object and can be accessed using window.navigator or simply navigator.

Properties of Navigator Object

No. Property Description
1 appName Returns the name of the browser.
2 appVersion Returns the version of the browser.
3 appCodeName Returns the code name of the browser.
4 cookieEnabled Returns true if cookies are enabled, otherwise false.
5 userAgent Returns the user agent string of the browser.
6 language Returns the language of the browser (supported in Netscape and Firefox).
7 userLanguage Returns the user language (supported in IE only).
8 plugins Returns an array of the browser's installed plugins (supported in Netscape and Firefox).
9 systemLanguage Returns the system language (supported in IE only).
10 mimeTypes Returns an array of MIME types supported by the browser (supported in Netscape and Firefox).
11 platform Returns the platform (e.g., Win32).
12 online Returns true if the browser is online, otherwise false.

Methods of Navigator Object

No. Method Description
1 javaEnabled() Checks if Java is enabled in the browser.
2 taintEnabled() Checks if taint is enabled (deprecated since JavaScript 1.2).

Example:

<script>
document.writeln("<br/>navigator.appCodeName: " + navigator.appCodeName);
document.writeln("<br/>navigator.appName: " + navigator.appName);
document.writeln("<br/>navigator.appVersion: " + navigator.appVersion);
document.writeln("<br/>navigator.cookieEnabled: " + navigator.cookieEnabled);
document.writeln("<br/>navigator.language: " + navigator.language);
document.writeln("<br/>navigator.userAgent: " + navigator.userAgent);
document.writeln("<br/>navigator.platform: " + navigator.platform);
document.writeln("<br/>navigator.onLine: " + navigator.onLine);
</script>

Output:

navigator.appCodeName: Mozilla
navigator.appName: Netscape
navigator.appVersion: 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
navigator.cookieEnabled: true
navigator.language: en-US
navigator.userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
navigator.platform: Win32
navigator.onLine: true