dom / latest / navigator.html /

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

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

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

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.

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.

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

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

Returns the number of logical processor cores available.

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

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.

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

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

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

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

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().

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.

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

Returns true if the browser can display PDF files inline when navigating to them, and false otherwise.

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

Returns a reference to the Presentation API.

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

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

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

Returns the user agent string for the current browser.

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

Indicates whether the user agent is controlled by automation.

Returns the WindowControlsOverlay interface which exposes information about the geometry of the title bar in desktop Progressive Web Apps, and an event to know whenever it changes.

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

Non-standard properties

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.

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.

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

Returns a boolean indicating whether the browser is running in standalone mode. Available on Apple's iOS Safari 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

Always returns 'Mozilla', in any browser.

Always returns 'Netscape', in any browser.

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

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

Returns a BatteryManager object. Use Navigator.getBattery() instead.

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.

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

Returns a string that represents the current operating system.

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

Returns a PluginArray listing the plugins installed in the browser.

Always returns 'Gecko', in any browser.

Returns either the string '20030107', or '"20100101'.

Returns either the empty string, 'Apple Computer Inc.', or 'Google Inc.'.

Always returns the empty string.

Methods

Doesn't inherit any method.

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

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

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

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

Returns a Promise for a MediaKeySystemAccess object.

Returns a Promise representing a request for access to MIDI devices on the user's system.

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

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

Invokes the native sharing mechanism of the current platform.

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

Deprecated methods

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

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

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

Always returns false.

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.
98
64-98
macOS support was enabled in Firefox 64.
55-98
Windows support was enabled in Firefox 55.
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
54
No
No
67
No
48
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
No
64
Returns a fixed timestamp as a privacy measure - 20181001000000.
4
No
No
No
canShare
93
89-93
Not supported on macOS.
93
89-93
Not supported on macOS.
96
No
79
75-79
Not supported on macOS.
14
No
75
96
54
14
11.0
clearAppBadge
81
Windows and macOS only.
81
Windows and macOS only.
No
No
No
No
No
81
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
48
No
See bug 185697.
50
38
14-99
The Network API is enabled by default. Can be disabled using the dom.netinfo.enabled preference.
37
No
See bug 185697.
3.0
contacts
No
No
No
No
No
No
80
80
No
57
14.5
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
25
9
Before Firefox 32, navigator.doNotTrack would report values of yes and no rather than 1 and 0.
12
5-7
1.5
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
32
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
79
12
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
98
64-98
macOS support was enabled in Firefox 64.
55-98
Windows support was enabled in Firefox 55.
No
No
No
No
79-80
Currently supported only by Google Daydream.
55
No
No
12.0-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
ink
94
94
No
No
80
No
94
94
No
66
No
17.0
javaEnabled
1
12
1
6
≤12.1
1
1
18
4
≤12.1
1
1.0
keyboard
68
79
No
No
55
No
68
68
No
48
No
10.0
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
96
93-96
No
56
15.4
69
69
96
48
15.4
10.0
maxTouchPoints
35
12
59
11
10
22
13
37
35
79
22
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
60
15
No
57
82
43
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, macOS: 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
Can incorrectly return true, see bug 811122.
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
pdfViewerEnabled
94
94
99
No
80
No
94
94
99
66
No
17.0
permissions
43
79
46
No
30
No
No
See bug 490120.
43
46
30
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
See bug 521319.
47
No
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
From Chrome 77, the URL parameter only accepts http or https URLs.
79
2
No
11.6
No
No
No
4
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
100
97-100
No
30
No
43
43
No
30
No
4.0
scheduling
87
87
No
No
74
No
87
87
No
62
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
75
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
81
Windows and macOS only.
81
Windows and macOS only.
No
No
No
No
No
81
No
58
No
13.0
share
93
89-93
Not supported on macOS.
93
89-93
Not supported on macOS.
71
No
79
75-79
Not supported on macOS.
12.1
No
61
79
48
12.2
8.0
storage
55
79
57
No
42
15.2
55
55
57
42
15.2
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
No
WebView exposes navigator.usb, but does not support WebUSB. See Chromium bug 933055.
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
See bug 921655.
90
No
64
No
15.0
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
19
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-16
19
["Beginning in Opera 42, this is not supported in cross-origin iframes.", "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."]
virtualKeyboard
94
94
No
No
80
No
94
94
No
66
No
17.0
wakeLock
84
84
No
No
70
No
84
84
No
60
No
14.0
webdriver
63
12
60
11
50
10
63
63
60
46
10
8.0
windowControlsOverlay
98
98
No
No
84
No
No
No
No
No
No
No
xr
79
79
No
No
66
No
No
79
No
57
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