Navigator

The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities.

A Navigator object can be retrieved using the read-only window.navigator property.

Properties

Doesn't inherit any properties.

Standard properties

Navigator.connection Read only

Provides a NetworkInformation object containing information about the network connection of a device.

Navigator.cookieEnabled Read only

Returns false if setting a cookie will be ignored and true otherwise.

Navigator.credentials Read only

Returns the CredentialsContainer interface which exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out.

Navigator.deviceMemory Read only

Returns the amount of device memory in gigabytes. This value is an approximation given by rounding to the nearest power of 2 and dividing that number by 1024.

Navigator.doNotTrack Read only

Reports the value of the user's do-not-track preference. When this value is "yes", your web site or application should not track the user.

Navigator.geolocation Read only

Returns a Geolocation object allowing accessing the location of the device.

Navigator.hid Read only

Returns an HID object providing methods for connecting to HID devices, listing attached HID devices, and event handlers for connected HID devices.

Navigator.hardwareConcurrency Read only

Returns the number of logical processor cores available.

Navigator.keyboard Read only

Returns a Keyboard object which provides access to functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard.

Navigator.language Read only

Returns a DOMString representing the preferred language of the user, usually the language of the browser UI. The null value is returned when this is unknown.

Navigator.languages Read only

Returns an array of DOMString representing the languages known to the user, by order of preference.

Navigator.locks Read only

Returns a LockManager object which provides methods for requesting a new Lock object and querying for an existing Lock object

Navigator.maxTouchPoints Read only

Returns the maximum number of simultaneous touch contact points are supported by the current device.

Navigator.mediaCapabilities Read only

Returns a MediaCapabilities object that can expose information about the decoding and encoding capabilities for a given format and output capabilities.

Navigator.mediaDevices Read only

Returns a reference to a MediaDevices object which can then be used to get information about available media devices (MediaDevices.enumerateDevices()), find out what constrainable properties are supported for media on the user's computer and user agent (MediaDevices.getSupportedConstraints()), and to request access to media using MediaDevices.getUserMedia().

Navigator.mediaSession Read only

Returns MediaSession object which can be used to provide metadata that can be used by the browser to present information about the currently-playing media to the user, such as in a global media controls UI.

Navigator.onLine Read only

Returns a boolean value indicating whether the browser is working online.

Navigator.permissions Read only

Returns a Permissions object that can be used to query and update permission status of APIs covered by the Permissions API.

Navigator.presentation Read only

Returns a reference to the Presentation API.

Navigator.serial Read only

Returns a Serial object, which represents the entry point into the Web Serial API to enable the control of serial ports.

Navigator.serviceWorker Read only

Returns a ServiceWorkerContainer object, which provides access to registration, removal, upgrade, and communication with the ServiceWorker objects for the associated document.

Navigator.storage Read only

Returns the singleton StorageManager object used for managing persistence permissions and estimating available storage on a site-by-site/app-by-app basis.

Navigator.userAgent Read only

Returns the user agent string for the current browser.

Navigator.userAgentData Read only

Returns a NavigatorUAData object, which gives access to information about the browser and operating system of the user.

Navigator.vendor Read only

Returns the vendor name of the current browser (e.g., "Netscape6").

Navigator.webdriver Read only

Indicates whether the user agent is controlled by automation.

Navigator.xr Read only

Returns XRSystem object, which represents the entry point into the WebXR API.

Non-standard properties

Navigator.buildID

Returns the build identifier of the browser. In modern browsers this property now returns a fixed timestamp as a privacy measure, e.g. 20181001000000 in Firefox 64 onwards.

Navigator.contacts Read only

Returns a ContactsManager interface which allows users to select entries from their contact list and share limited details of the selected entries with a website or application.

Navigator.securitypolicy

Returns an empty string. In Netscape 4.7x, returns "US & CA domestic policy" or "Export policy".

Navigator.standalone

Returns a boolean indicating whether the browser is running in standalone mode. Available on Apple's iOS Safari only.

Navigator.wakeLock Read only

Returns a WakeLock interface you can use to request screen wake locks and prevent screen from dimming, turning off, or showing a screen saver.

Deprecated properties

Navigator.appCodeName Read only

Returns the internal "code" name of the current browser. Do not rely on this property to return the correct value.

Navigator.appName Read only

Returns a DOMString with the official name of the browser. Do not rely on this property to return the correct value.

Navigator.appVersion Read only

Returns the version of the browser as a DOMString. Do not rely on this property to return the correct value.

Navigator.activeVRDisplays Read only

Returns an array containing every VRDisplay object that is currently presenting (VRDisplay.ispresenting is true).

Navigator.battery Read only

Returns a BatteryManager object you can use to get information about the battery charging status.

Navigator.mimeTypes Read only

Returns an MimeTypeArray listing the MIME types supported by the browser.

Navigator.oscpu Read only

Returns a string that represents the current operating system.

Navigator.platform Read only

Returns a string representing the platform of the browser. Do not rely on this function to return a significant value.

Navigator.plugins Read only

Returns a PluginArray listing the plugins installed in the browser.

Navigator.product Read only

Always returns 'Gecko', on any browser. This property is kept only for compatibility purpose.

Navigator.productSub Read only

Returns the build number of the current browser (e.g., "20060909").

Navigator.vendorSub Read only

Returns the vendor version number (e.g. "6.1").

Methods

Doesn't inherit any method.

Navigator.canShare()

Returns true if a call to Navigator.share() would succeed.

Navigator.clearAppBadge()

Clears a badge on the current app's icon and returns a Promise that resolves with undefined.

Navigator.getBattery()

Returns a promise that resolves with a BatteryManager object that returns information about the battery charging status.

Navigator.javaEnabled() Read only

Returns false.

Navigator.registerProtocolHandler()

Allows web sites to register themselves as a possible handler for a given protocol.

Navigator.requestMediaKeySystemAccess()

Returns a Promise for a MediaKeySystemAccess object.

Navigator.sendBeacon()

Used to asynchronously transfer a small amount of data using HTTP from the User Agent to a web server.

Navigator.setAppBadge()

Sets a badge on the icon associated with this app and returns a Promise that resolves with undefined.

Navigator.share()

Invokes the native sharing mechanism of the current platform.

Navigator.vibrate()

Causes vibration on devices with support for it. Does nothing if vibration support isn't available.

Deprecated methods

Navigator.getVRDisplays()

Returns a promise that resolves to an array of VRDisplay objects representing any available VR devices connected to the computer.

Navigator.getUserMedia()

After having prompted the user for permission, returns the audio or video stream associated to a camera or microphone on the local computer.

Navigator.taintEnabled()

Returns false. JavaScript taint/untaint functions removed in JavaScript 1.2.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
Navigator
1
12
1
4
3
1
1
18
4
10.1
1
1.0
activeVRDisplays
No
15-79
WebVR content requires a Windows Mixed Reality headset or the Windows Mixed Reality Portal Simulator.
55
Windows support was enabled in Firefox 55.
64
macOS support was enabled in Firefox 64.
No
No
No
No
79-80
Supported only by Google Daydream.
55
No
No
12.0-13.0
Supported only by Google Daydream.
appCodeName
1
12
1
4
≤12.1
1
1
18
4
≤12.1
1
1.0
appName
1
12
1
4
≤12.1
1
1
18
4
≤12.1
1
1.0
appVersion
1
12
1
4
≤12.1
1
1
18
4
≤12.1
1
1.0
authentication
67
79
No
No
?
No
No
67
No
?
No
No
bluetooth
56
Before Chrome 70, this feature was only supported in macOS. In Chrome 70, support was added for Windows 10. Linux support is not enabled by default.
56
In Linux and versions of Windows earlier than 10, this flag must be enabled.
79
Supported by default only on macOS and Windows 10. Linux support is not enabled by default.
79
In Linux and versions of Windows earlier than 10, this flag must be enabled.
No
No
43
Before Opera 57, this feature was only supported in macOS. In Opera 57, support was added for Windows 10. Linux support is not enabled by default.
43
In Linux and versions of Windows earlier than 10, this flag must be enabled.
No
No
56
No
43
No
6.0
buildID
No
No
64
Returns a fixed timestamp as a privacy measure - 20181001000000.
2
No
?
No
No
No
64
Returns a fixed timestamp as a privacy measure - 20181001000000.
Yes
?
No
No
canShare
89
Not supported on macOS, see bug 1144920.
89
Not supported on macOS, see bug 1144920.
No
No
75
Not supported on macOS, see bug 1144920.
14
No
75
No
54
14
11.0
clearAppBadge
83
Windows and Mac only.
81
No
No
No
No
No
No
No
58
No
13.0
clipboard
66
79
63
No
53
13.1
66
66
63
47
13.4
9.0
connection
61
79
31
No
Yes
No
50
38
14
The Network API is enabled by default. Can be disabled using the dom.netinfo.enabled preference.
37
No
3.0
contacts
No
No
No
No
No
No
80
80
No
57
No
13.0
cookieEnabled
1
12
1
Before Firefox 8, navigator.cookieEnabled would report the wrong result if a site exception was in place for the page on which the check was performed. This has been fixed.
4
navigator.cookieEnabled returns true even if the browser is set to block cookies (for example, if the page is in the Restricted sites security zone).
≤12.1
1
1
18
4
Before Firefox 8, navigator.cookieEnabled would report the wrong result if a site exception was in place for the page on which the check was performed. This has been fixed.
≤12.1
1
1.0
credentials
51
18
61
No
38
13
51
51
61
41
13
5.0
deviceMemory
63
79
No
No
50
No
63
63
No
46
No
8.0
doNotTrack
23
17
Before version 17, Edge implemented window.doNotTrack.
9
Before Firefox 32, navigator.doNotTrack would report values of yes and no rather than 1 and 0.
9-11
For IE11 and subsequent versions, use window.doNotTrack
12
5.1-7
≤37
Yes
9
Before Firefox 32, navigator.doNotTrack would report values of yes and no rather than 1 and 0.
?
5-7
Yes
geolocation
5
12
3.5
9
10.6
5
≤37
18
4
11
≤3
1.0
getBattery
38
79
43-52
No
25
No
38
38
43-52
25
No
3.0
getGamepads
35
21
12
29
No
22
15
10.1
37
≤37
35
25
No
22
14
10.3
3.0
1.5
getInstalledRelatedApps
85
Only supported on Windows. Resolves with an empty array on other platforms.
80-85
Always resolves with an empty array.
85
Only supported on Windows. Resolves with an empty array on other platforms.
80-85
Always resolves with an empty array.
No
No
71
Only supported on Windows. Resolves with an empty array on other platforms.
67-71
Always resolves with an empty array.
No
No
80
No
No
No
13.0
getUserMedia
53
21
12
79
17
No
40
15
12-15
11-12
53
40
53
25
24
41
14
12-14
11-12
6.0
1.5
getVRDisplays
No
Available on all platforms behind a flag, but currently only works on desktop in an experimental version of Chrome (other builds won't return any devices when Navigator.getVRDisplays() is invoked).
15-79
55
Windows support was enabled in Firefox 55.
64
macOS support was enabled in Firefox 64.
No
No
No
No
Yes-80
Currently supported only by Google Daydream.
55
No
No
Yes-13.0
Currently supported only by Google Daydream.
hardwareConcurrency
37
15
48
No
24
10.1-11
37
37
48
24
10.3-11
3.0
hid
89
89
No
No
75
No
No
No
No
No
No
No
javaEnabled
1
12
1
6
≤12.1
1
1
18
4
≤12.1
1
1.0
keyboard
68
79
No
No
55
No
68
No
No
No
No
No
language
1
12
1
Before Firefox 4, this property's value was also part of the user agent string, as reported by navigator.userAgent. Starting in Firefox 5, this property's value is based on the value of the Accept-Language HTTP header.
11
Closest available (non-standard) properties are userLanguage and browserLanguage.
4
1
1
18
4
10.1
1
1.0
languages
37
Before Chrome 65, navigator.languages[0] is not guaranteed to equal navigator.language.
16
32
In Firefox, the navigator.languages property's value is taken from the intl.accept_languages preference.
No
Closest available (non-standard) properties are userLanguage and browserLanguage.
24
10.1
37
Before version 65, navigator.languages[0] is not guaranteed to equal navigator.language.
37
Before Chrome 65, navigator.languages[0] is not guaranteed to equal navigator.language.
32
In Firefox, the navigator.languages property's value is taken from the intl.accept_languages preference.
24
10.3
3.0
locks
69
79
No
No
56
No
69
69
No
48
No
10.0
maxTouchPoints
35
12
59
29
11
10
Yes
13
37
35
79
29
Yes
13
3.0
mediaCapabilities
66
79
63
No
55
13
66
66
63
48
13
9.0
mediaDevices
47
12
36
No
34
11
47
47
36
34
11
5.0
mediaSession
73
79
82
71
No
No
15
No
57
82
No
15
7.0
mimeTypes
1
12
1
4
≤12.1
1
1
18
4
≤12.1
1
1.0
mozIsLocallyAvailable
No
No
3-35
No
No
No
No
No
4-35
No
No
No
onLine
1
Earlier versions of Chrome incorrectly return true when a tab is first opened, but it starts reporting the correct connectivity status after the first network event. Windows: 11, Mac: 14, Chrome OS: 13, Linux: Always returns true. For history, see crbug.com/7469.
12
1.5
Since Firefox 4 the browser returns true when 'Work Offline' mode is disabled and false when it is enabled, regardless of actual connectivity. Since Firefox 41, on OS X and Windows, the returned values follow the actual network connectivity, unless 'Work offline' mode is selected (where it will always return false).
4
in Internet Explorer 8 'online' and 'offline' events are raised on the document.body; under IE 9 they are raised on both document.body and window.
3
From Opera 11.1 until Opera 12.1, the browser returns true when 'Work Offline' mode is disabled and false when it is enabled, regardless of actual connectivity.
4
≤37
Faulty in a WebView component, see Issue bug 16760.
18
4
10.1
From Opera 11.1 until Opera 12.1, the browser returns true when 'Work Offline' mode is disabled and false when it is enabled, regardless of actual connectivity.
3.2
1.0
oscpu
No
No
1
The preference "general.oscpu.override" can be used to set a value to be returned instead of the true CPU description. The preference setting is ignored for calls made by privileged code, which continue to get the actual CPU description.
No
No
No
No
No
4
The preference "general.oscpu.override" can be used to set a value to be returned instead of the true CPU description. The preference setting is ignored for calls made by privileged code, which continue to get the actual CPU description.
No
No
No
permissions
43
79
46
No
Yes
No
No
43
46
Yes
No
4.0
platform
1
12
1
["Before Firefox 69, platform would report running on a 32-bit CPU if running the 32-bit version of Firefox on a 64-bit system.", "You can override the value returned by platform by setting the preference general.platform.override to the string you wish to be returned instead."]
4
≤12.1
1
1
18
4
≤12.1
1
1.0
plugins
1
12
1
4
≤12.1
1
1
18
4
≤12.1
1
1.0
presentation
47
79
51-88
No
34
No
No
47
51-79
34
No
5.0
product
1
12
1
11
15
1
1
18
4
14
1
1.0
productSub
1
Always returns 20030107.
12
Always returns 20030107.
1
No
15
Always returns 20030107.
1
Always returns 20030107.
1
Always returns 20030107.
18
Always returns 20030107.
4
14
Always returns 20030107.
1
Always returns 20030107.
1.0
Always returns 20030107.
registerProtocolHandler
13
["Allowed schemes include mailto, mms, nntp, rtsp, and webcal. Custom protocols must be prefixed with web+.", "From Chrome 77, the URL parameter only accepts http or https URLs.", "The obsolete title argument is required."]
79
["Allowed schemes include mailto, mms, nntp, rtsp, and webcal. Custom protocols must be prefixed with web+.", "The obsolete title argument is required."]
3
No
11.6
The obsolete title argument is required.
No
No
No
No
No
No
No
requestMediaKeySystemAccess
42
["The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.", "The function does not exist in insecure contexts. This was not enforced until Chrome 58."]
13
38
["Starting in Firefox 55, if neither audioCapabilities nor videoCapabilities is specified in supportedConfigurations, a warning is output to the web console.", "In addition, starting in Firefox 55, if in supportedConfigurations, either audioCapabilities's or videoCapabilities's contentType value doesn't specify a \"codecs\" substring to define allowed codecs within the media wrapper, a warning is output to the web console. See note below table for example and correction.", "In the future, if neither audioCapabilities nor videoCapabilities is specified in the supportedConfigurations, a NotSupported exception will be thrown."]
No
29
["The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.", "The function does not exist in insecure contexts. This was not enforced until Opera 45."]
13.1
43
["The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.", "The function does not exist in insecure contexts. This was not enforced until version 58."]
42
["The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.", "The function does not exist in insecure contexts. This was not enforced until Chrome 58."]
38
["Starting in Firefox 55, if neither audioCapabilities nor videoCapabilities is specified in supportedConfigurations, a warning is output to the web console.", "In addition, starting in Firefox 55, if in supportedConfigurations, either audioCapabilities's or videoCapabilities's contentType value doesn't specify a \"codecs\" substring to define allowed codecs within the media wrapper, a warning is output to the web console. See note below table for example and correction.", "In the future, if neither audioCapabilities nor videoCapabilities is specified in the supportedConfigurations, a NotSupported exception will be thrown."]
29
["The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.", "The function does not exist in insecure contexts. This was not enforced until Opera 45."]
13.4
4.0
["The spec requires that the passed supportedConfigurations option contain at least one of audioCapabilities or videoCapabilities, and that said parameters include a codec string.", "The function does not exist in insecure contexts. This was not enforced until Samsung Internet 7.0."]
requestMIDIAccess
43
79
No
No
30
No
43
43
No
30
No
4.0
scheduling
87
No
No
No
No
No
87
87
No
No
No
14.0
sendBeacon
39
Starting in Chrome 59, this method cannot send a Blob whose type is not CORS safelisted. This is a temporary change until a mitigation can be found for the security issues that this creates. For more information see Chrome bug 720283.
14
31
No
26
Starting in Opera 46, this method cannot send a Blob whose type is not CORS safelisted. This is a temporary change until a mitigation can be found for the security issues that this creates. For more information see Chrome bug 720283.
11.1
40
Starting in Chrome 59, this method cannot send a Blob whose type is not CORS safelisted. This is a temporary change until a mitigation can be found for the security issues that this creates. For more information see Chrome bug 720283.
42
Starting in Chrome 59, this method cannot send a Blob whose type is not CORS safelisted. This is a temporary change until a mitigation can be found for the security issues that this creates. For more information see Chrome bug 720283.
31
26
Starting in Opera 46, this method cannot send a Blob whose type is not CORS safelisted. This is a temporary change until a mitigation can be found for the security issues that this creates. For more information see Chrome bug 720283.
11.3
4.0
Starting in Samsung Internet 7.0, this method cannot send a Blob whose type is not CORS safelisted. This is a temporary change until a mitigation can be found for the security issues that this creates. For more information see Chrome bug 720283.
serial
89
89
No
No
No
No
No
No
No
No
No
No
serviceWorker
40
17
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
No
27
11.1
40
40
44
27
11.3
4.0
setAppBadge
83
Windows and Mac only.
83
Windows and Mac only.
No
No
No
No
No
No
No
58
No
13.0
share
89
Not supported on macOS, see bug 1144920.
81
71
No
75
12.1
No
61
79
48
12.2
8.0
storage
55
79
57
No
42
No
55
55
57
42
No
6.0
taintEnabled
No
No
1
6
≤12.1-15
No
No
No
4
≤12.1-14
No
No
unregisterProtocolHandler
38
79
No
No
25
≤12.1-15
No
No
No
No
No
No
No
usb
61
79
No
No
48
No
61
61
No
45
No
8.0
userAgent
1
12
1
4
≤12.1
1
1
18
4
≤12.1
1
1.0
userAgentData
90
90
No
No
76
No
No
90
No
No
No
No
vendor
1
12
1
11
15
1
1
18
4
14
1
1.0
vendorSub
1
12
1
No
15
3
1
18
4
14
1
1.0
vibrate
32
79
16
["Until Firefox 26 included, when the vibration pattern was too long or any of its elements too large, Firefox threw an exception instead of returning false (bug 884935).", "From Firefox 32 onwards, when the vibration pattern is too long or any of its elements too large, it returns true but truncates the pattern (bug 1014581).", "Beginning in Firefox 72, this is not supported in cross-origin iframes."]
11-16
No
No
No
4.4.3
["Beginning in version 55, this is not supported in cross-origin iframes.", "Beginning in version 60, this method requires a user gesture. Otherwise it returns false."]
32
["Beginning in Chrome 55, this is not supported in cross-origin iframes.", "Beginning in Chrome 60, this method requires a user gesture. Otherwise it returns false."]
79
Vibration is disabled. If the window is visible, then navigator.vibrate() returns true, but no vibration takes place (regardless of hardware support). See bug 1591113.
16-79
["Until Firefox 26 included, when the vibration pattern was too long or any of its elements too large, Firefox threw an exception instead of returning false (bug 884935).", "From Firefox 32 onwards, when the vibration pattern is too long or any of its elements too large, it returns true but truncates the pattern (bug 1014581)."]
14-true
Yes
Beginning in Opera 47, this method requires a user gesture. Otherwise it returns false.
No
2.0
["Beginning in Samsung Internet 6.0, this is not supported in cross-origin iframes.", "Beginning in Samsung Internet 8.0, this method requires a user gesture. Otherwise it returns false."]
wakeLock
84
84
No
No
Yes
No
84
84
No
Yes
No
14.0
webdriver
63
12
60
11
50
10
No
63
60
46
10
8.0
xr
79
79
No
No
No
No
No
79
No
No
No
11.2

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator