This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

Navigator

Summary

The navigator object contains state and identity information about the browser/user agent.

Properties

appCodeName
Returns the internal “code” name of the current browser. Do not rely on this property to return the correct value.
appMinorVersion
Retrieves the userAgent application’s minor version value.
appName
appName Returns a string with the name of the browser/user agent. The HTML5 specification also allows any browser to return “Netscape” here, for compatibility reasons.
appVersion
Returns the version of the browser as a string. It may be either a plain version number, like "5.0", or a version number followed by more detailed information. The HTML5 specification also allows any browser to return “4.0” here, for compatibility reasons.

constructor
:

cookieEnabled

Retrieves whether client-side persistent cookies are enabled. Persistent cookies are those that are stored on the client-side computer.

doNotTrack

Returns the user’s do-not-track setting. This is “yes” if the user has requested not to be tracked by web sites, content, or advertising.

maxTouchPoints

The maximum number of simultaneous touch contacts supported by the device.

platform

Retrieves the name of the user’s operating system.

In IE10 and higher and WaterFox browsers this will return the bitness of the current tab. eg

Win32 or Win64.

pointerEnabled

Indicates if the browser will fire pointer events for pointing input.

In late 2013, pointerEnabled was removed from the specification as checking PointerEvent in Window object is sufficient for feature detection. Do not use this property and use PointerEvent instead.

userLanguage

Retrieves the operating system’s natural language setting.

This property reflects the setting in the "Your locale (location)" box in the Regional Options of Control Panel—for example, "English (United States).

Methods

getGamepads
Retrieves a snapshot of the data for the currently connected and interacted-with gamepads. Returns a Gamepad object.
getUserMedia
Prompts the user for permission to use a media device such as a camera or microphone. If the user provides permission, the successCallback is invoked on the calling application with a LocalMediaStream object as its argument.
javaEnabled
This method indicates whether the current browser is Java Run Time Environment-enabled or not.
sendBeacon
Asynchronously queues small amounts of HTTP data for transfer from the user agent to a web server. For example, it can be used to send analytics or diagnostics code without delaying the page’s unload or affecting the performance of the navigation.

Events

No events.

Examples

[object Navigator] example enumerates the window.navigator object and displays the results in the web page.


View live example

Usage

 Commonly used for feature detection of a web browser capabilities. java RTE and cookie support.

Avoid UserAgent sniffing of the navigator.userAgent property as this is not a reliable indicator of the userAgent’s actual version number.

Attributions