JavaScript navigator object

  • Navigator Object
  • Properties of Navigator Object
  • Methods of Navigator Object
  • Example of Navigator Object

The navigator object in JavaScript serves the purpose of detecting the browser being utilized. This object can retrieve various details about the browser, including attributes like appName, appCodeName, userAgent, and more.

The navigator object is a property of the window, which means it can be accessed using:

Example

window.navigator
Example

navigator

Property of JavaScript navigator object

The navigator object encompasses various properties that provide details regarding the web browser in use.

No. Property Description
1 appName returns the name
2 appVersion returns the version
3 appCodeName returns the code name
4 cookieEnabled returns true if cookie is enabled otherwise false
5 userAgent returns the user agent
6 language returns the language. It is supported in Netscape and Firefox only.
7 userLanguage returns the user language. It is supported in IE only.
8 plugins returns the plugins. It is supported in Netscape and Firefox only.
9 systemLanguage returns the system language. It is supported in IE only.
10 mimeTypes[] returns the array of mime type. It is supported in Netscape and Firefox only.
11 platform returns the platform e.g. Win32.
12 online returns true if browser is online otherwise false.

Methods of JavaScript navigator object

The methods of navigator object are given below.

No. Method Description
1 javaEnabled() checks if java is enabled.
2 taintEnabled() checks if taint is enabled. It is deprecated since JavaScript 1.2.

Example of navigator object

Let’s see the different usage of history object.

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>
Example

navigator.appCodeName: Mozilla 

navigator.appName: Netscape 

navigator.appVersion: 5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 

(KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36 

navigator.cookieEnabled: true 

navigator.language: en-US 

navigator.userAgent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 

(KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36 

navigator.platform: Win32 

navigator.onLine: true

Input Required

This code uses input(). Please provide values below: