Navigator
Baseline Widely available *
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
TheNavigator 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.
ANavigator object can be retrieved using the read-onlywindow.navigator property.
In this article
Instance properties
Doesn't inherit any properties.
Standard properties
Navigator.bluetoothRead onlyExperimentalSecure contextReturns a
Bluetoothobject for the current document, providing access toWeb Bluetooth API functionality.Navigator.clipboardRead onlySecure contextReturns a
Clipboardobject that provides read and write access to the system clipboard.Navigator.connectionRead onlyReturns a
NetworkInformationobject containing information about the network connection of a device.Navigator.contactsRead onlyExperimentalSecure contextReturns a
ContactsManagerinterface which allows users to select entries from their contact list and share limited details of the selected entries with a website or application.Navigator.cookieEnabledRead onlyReturns false if setting a cookie will be ignored and true otherwise.
Navigator.credentialsRead onlySecure contextReturns the
CredentialsContainerinterface which exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out.Navigator.deviceMemoryRead onlySecure contextReturns 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.devicePostureRead onlyExperimentalReturns the browser's
DevicePostureobject, which allows developers to query the device's current posture (that is, whether the viewport is in a flat or folded state) and run code in response to posture changes.Navigator.geolocationRead onlyReturns a
Geolocationobject allowing accessing the location of the device.Navigator.gpuRead onlySecure contextReturns the
GPUobject for the current browsing context. The entry point for theWebGPU API.Navigator.hardwareConcurrencyRead onlyReturns the number of logical processor cores available.
Navigator.hidRead onlyExperimentalSecure contextReturns an
HIDobject providing methods for connecting to HID devices, listing attached HID devices, and event handlers for connected HID devices.Navigator.inkRead onlyExperimentalReturns an
Inkobject for the current document, providing access toInk API functionality.Navigator.keyboardRead onlyExperimentalSecure contextReturns a
Keyboardobject which provides access to functions that retrieve keyboard layout maps and toggle capturing of key presses from the physical keyboard.Navigator.languageRead onlyReturns a string representing the preferred language of the user, usually the language of the browser UI. The
nullvalue is returned when this is unknown.Navigator.languagesRead onlyReturns an array of strings representing the languages known to the user, by order of preference.
Navigator.locksRead onlySecure contextReturns a
LockManagerobject that provides methods for requesting a newLockobject and querying for an existingLockobject.Navigator.loginRead onlySecure contextProvides access to the browser's
NavigatorLoginobject, which a federated identity provider (IdP) can use to set a user's login status when they sign into or out of the IdP. SeeFederated Credential Management (FedCM) API for more details.Navigator.maxTouchPointsRead onlyReturns the maximum number of simultaneous touch contact points are supported by the current device.
Navigator.mediaCapabilitiesRead onlyReturns a
MediaCapabilitiesobject that can expose information about the decoding and encoding capabilities for a given format and output capabilities.Navigator.mediaDevicesRead onlySecure contextReturns a reference to a
MediaDevicesobject 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 usingMediaDevices.getUserMedia().Navigator.mediaSessionRead onlyReturns
MediaSessionobject 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.onLineRead onlyReturns a boolean value indicating whether the browser is working online.
Navigator.pdfViewerEnabledRead onlyReturns
trueif the browser can display PDF files inline when navigating to them, andfalseotherwise.Navigator.permissionsRead onlyReturns a
Permissionsobject that can be used to query and update permission status of APIs covered by thePermissions API.Navigator.presentationRead onlySecure contextReturns a reference to the
PresentationAPI.Navigator.schedulingRead onlyExperimentalReturns a
Schedulingobject for the current document.Navigator.serialRead onlyExperimentalSecure contextReturns a
Serialobject, which represents the entry point into theWeb Serial API to enable the control of serial ports.Navigator.serviceWorkerRead onlySecure contextReturns a
ServiceWorkerContainerobject, which provides access to registration, removal, upgrade, and communication with theServiceWorkerobjects for theassociated document.Navigator.storageRead onlySecure contextReturns the singleton
StorageManagerobject used for managing persistence permissions and estimating available storage on a site-by-site/app-by-app basis.Navigator.usbRead onlySecure contextReturns a
USBobject for the current document, providing access toWebUSB API functionality.Navigator.userActivationRead onlyReturns a
UserActivationobject containing information about the current window's user activation state.Navigator.userAgentRead onlyReturns the user agent string for the current browser.
Navigator.userAgentDataRead onlyExperimentalSecure contextReturns a
NavigatorUADataobject, which gives access to information about the browser and operating system of the user.Navigator.virtualKeyboardRead onlyExperimentalSecure contextReturns a reference to the
VirtualKeyboardAPI, to take control of the on-screen virtual keyboard.Navigator.wakeLockRead onlySecure contextReturns a
WakeLockinterface you can use to request screen wake locks and prevent screen from dimming, turning off, or showing a screen saver.Navigator.webdriverRead onlyIndicates whether the user agent is controlled by automation.
Navigator.windowControlsOverlayRead onlySecure contextReturns the
WindowControlsOverlayinterface which exposes information about the geometry of the title bar in desktop Progressive Web Apps, and an event to know whenever it changes.Navigator.xrRead onlyExperimentalSecure contextReturns
XRSystemobject, which represents the entry point into theWebXR API.
Non-standard properties
Navigator.buildIDRead onlyNon-standardReturns the build identifier of the browser. In modern browsers this property now returns a fixed timestamp as a privacy measure, e.g.,
20181001000000in Firefox 64 onwards.Navigator.globalPrivacyControlRead onlyExperimentalReturns a boolean indicating a user's consent to their information being shared or sold.
Navigator.standaloneNon-standardReturns a boolean indicating whether the browser is running in standalone mode. Available on Apple's iOS Safari only.
Deprecated properties
Navigator.activeVRDisplaysRead onlyDeprecatedNon-standardReturns an array containing every
VRDisplayobject that is currently presenting (VRDisplay.isPresentingistrue).Navigator.appCodeNameRead onlyAlways returns
'Mozilla', in any browser.Navigator.appNameRead onlyAlways returns
'Netscape', in any browser.Navigator.appVersionRead onlyReturns the version of the browser as a string. Do not rely on this property to return the correct value.
Navigator.doNotTrackRead onlyDeprecatedNon-standardReports the value of the user's do-not-track preference. When this value is "1", your website or application should not track the user.
Navigator.mimeTypesRead onlyReturns a
MimeTypeArraylisting the MIME types supported by the browser.Navigator.oscpuRead onlyReturns a string that represents the current operating system.
Navigator.platformRead onlyReturns a string representing the platform of the browser. Do not rely on this function to return a significant value.
Navigator.pluginsRead onlyReturns a
PluginArraylisting the plugins installed in the browser.Navigator.productRead onlyAlways returns
'Gecko', in any browser.Navigator.productSubRead onlyReturns either the string
'20030107', or'"20100101'.Navigator.vendorRead onlyReturns either the empty string,
'Apple Computer Inc.', or'Google Inc.'.Navigator.vendorSubRead onlyAlways returns the empty string.
Instance methods
Doesn't inherit any method.
Navigator.canShare()Secure contextReturns
trueif a call toNavigator.share()would succeed.Navigator.clearAppBadge()Secure contextClears a badge on the current app's icon and returns a
Promisethat resolves withundefined.Navigator.deprecatedReplaceInURN()ExperimentalSubstitutes specified strings inside the mapped URL corresponding to a given opaque URN or
FencedFrameConfig's internalurlproperty. This method has been made available as a temporary measure (hence "deprecated") to enable that substitution for fenced frame URLs, helping ad tech providers to migrate existing implementations across toprivacy sandbox APIs.Navigator.getAutoplayPolicy()ExperimentalReturns a value indicating whether the specified media element, audio context, or media feature "type" is allowed to autoplay.
Navigator.getBattery()Secure contextReturns a promise that resolves with a
BatteryManagerobject that returns information about the battery charging status.Navigator.getGamepads()returns an array of
Gamepadobjects, one for each gamepad connected to the device.Navigator.getInstalledRelatedApps()ExperimentalSecure contextReturns a promise that resolves with an array of objects representing any related native orProgressive Web Applications that the user has installed.
Navigator.registerProtocolHandler()Secure contextAllows websites to register themselves as a possible handler for a given protocol.
Navigator.requestMediaKeySystemAccess()Secure contextReturns a
Promisefor a MediaKeySystemAccess object.Navigator.requestMIDIAccess()Secure contextReturns a
Promiserepresenting a request for access to MIDI devices on the user's system.Navigator.sendBeacon()Used to asynchronously transfer a small amount of data usingHTTP from the User Agent to a web server.
Navigator.setAppBadge()Secure contextSets a badge on the icon associated with this app and returns a
Promisethat resolves withundefined.Navigator.share()Secure contextInvokes 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.
Navigator.unregisterProtocolHandler()Secure contextUnregister a website that is a handler for a given protocol.
Deprecated methods
Navigator.getUserMedia()DeprecatedSecure contextAfter having prompted the user for permission, returns the audio or video stream associated to a camera or microphone on the local computer.
Navigator.getVRDisplays()DeprecatedNon-standardReturns a promise that resolves to an array of
VRDisplayobjects representing any available VR devices connected to the computer.Navigator.javaEnabled()Always returns false.
Navigator.taintEnabled()Returns
false. JavaScript taint/untaint functions removed in JavaScript 1.2.
Specifications
| Specification |
|---|
| HTML> # the-navigator-object> |