JavaScript Tutorial
JS - Introduction JS - Basic JS - Placement JS - Output JS - Statements JS - Syntax JS - Variables JS - Comments JS - Data Types JS - Operators JS - Operator Precedence JS - Condition JS - Switch JS - Functions JS - Objects JS - Loops For JS - Loops While JS - Break JS - Strings JS - String Methods JS - Numbers JS - Number Methods JS - Arrays JS - Array Methods JS - Array Iteration JS - Events JS - Event Listener JS - Event Propagation JS - Date JS - Math JS - Random JS - Boolean JS - Type Conversion JS - RegExp JS - Exception JS - Scope JS - Debugging JS - Hoisting JS - Strict Mode JS - this Keyword JS - Mistakes JS - Best Practices JS - Performance JS - Form Validation JS - ES6 Features
JS Objects
Object Definitions Object Properties Object Methods Object Constructors Object Prototypes
JS Functions
Function Definitions Function Parameters Function Call Function Apply Function Closures
JS HTML DOM
DOM Introduction DOM Methods DOM Selectors DOM HTML DOM CSS DOM Attributes DOM Navigation
JS Browser BOM
JS - Window JS - Screen JS - Location JS - History JS - Navigator JS - Popup Alert JS - Timing JS - Cookies
JS AJAX
AJAX - Introduction AJAX - XMLHttp AJAX - Request AJAX - Response AJAX - PHP
JS JSON
JSON - Introduction JSON - Syntax JSON - Data Types JSON - Parse JSON - Stringify JSON - Objects JSON - Arrays JSON - PHP JSON - JSONP
JS References
JavaScript Reference JavaScript Methods HTML DOM Reference

JavaScript Window Navigator

The navigator property of a window (i.e. window.navigator) is a reference to a Navigator object.


The Navigator Object

The window.navigator object contains information about the user's browser.

The window.navigator object can be written without the window prefix.

Some examples:

The following section will show you how to get various information about user's browser.


Browser Application Name

The navigator.appName property returns the name of the browser.

Run code

Note: Do not rely on this property to return the correct browser name. All browsers return "Netscape" as the value of this property.


Browser Application Code Name

The navigator.appCodeName property returns the code name of the browser.

Run code

Note: Do not rely on this property to return a real product name. All browsers return "Mozilla" as the value of this property.


The Browser Engine

The navigator.product property returns the product (engine) name of the browser.

Run code

Note: Do not rely on this property to return a real engine name. All browsers return "Gecko" as the value of this property.



The Browser Version

The navigator.appVersion property returns the version information of the browser.

Run code

The Browser Agent

The navigator.userAgent property returns the value of the user-agent header sent by the browser to the server.

Run code

Usage Note

The information from the navigator object can often be misleading, and should not be used to detect browser versions because:

  • Different browsers can use the same name
  • The navigator data can be changed by the browser owner
  • Some browsers misidentify themselves to bypass site tests
  • Browsers cannot report new operating systems, released later than the browser

The Browser Platform

The navigator.platform property returns a string representing the platform (operating system) of the browser.

Run code

The Browser Language

The navigator.language property returns the language version of the browser.

Run code

Browser Cookies

The navigator.cookieEnabled property returns a Boolean value that specifies whether cookies are enabled in the browser.

This property returns true if cookies are enabled, otherwise it returns false.

Run code

You can learn more about cookies in our JavaScript Cookies Tutorial.


Is The Browser Online?

The navigator.onLine property returns a Boolean value that specifies whether the browser is in online or offline mode.

This property returns true if the browser is online, otherwise it returns false.

Run code

Is Java Enabled?

The navigator.javaEnabled() method returns a Boolean value that specifies whether the browser has Java enabled.

This method returns true if the browser has Java enabled, otherwise it returns false.

Run code

Java is an object oriented programming language, owned by Oracle.


More Examples

This example shows all navigator properties:

Run code

Complete Navigator Reference

For a complete properties and methods reference, visit our JavaScript Navigator Object Reference.

The reference section contains descriptions and examples of all navigator properties and methods.