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.bluetooth
Read onlyExperimentalSecure contextReturns a
Bluetooth
object for the current document, providing access toWeb Bluetooth API functionality.Navigator.clipboard
Read onlySecure contextReturns a
Clipboard
object that provides read and write access to the system clipboard.Navigator.connection
Read onlyReturns a
NetworkInformation
object containing information about the network connection of a device.Navigator.contacts
Read onlyExperimentalSecure contextReturns 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.cookieEnabled
Read onlyReturns false if setting a cookie will be ignored and true otherwise.
Navigator.credentials
Read onlySecure contextReturns 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 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.devicePosture
Read onlyExperimentalReturns the browser's
DevicePosture
object, 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.geolocation
Read onlyReturns a
Geolocation
object allowing accessing the location of the device.Navigator.gpu
Read onlySecure contextReturns the
GPU
object for the current browsing context. The entry point for theWebGPU API.Navigator.hardwareConcurrency
Read onlyReturns the number of logical processor cores available.
Navigator.hid
Read onlyExperimentalSecure contextReturns an
HID
object providing methods for connecting to HID devices, listing attached HID devices, and event handlers for connected HID devices.Navigator.ink
Read onlyExperimentalReturns an
Ink
object for the current document, providing access toInk API functionality.Navigator.keyboard
Read onlyExperimentalSecure contextReturns 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 onlyReturns a string 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 onlyReturns an array of strings representing the languages known to the user, by order of preference.
Navigator.locks
Read onlySecure contextReturns a
LockManager
object that provides methods for requesting a newLock
object and querying for an existingLock
object.Navigator.login
Read onlySecure contextProvides access to the browser's
NavigatorLogin
object, 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.maxTouchPoints
Read onlyReturns the maximum number of simultaneous touch contact points are supported by the current device.
Navigator.mediaCapabilities
Read onlyReturns a
MediaCapabilities
object that can expose information about the decoding and encoding capabilities for a given format and output capabilities.Navigator.mediaDevices
Read onlySecure contextReturns 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 usingMediaDevices.getUserMedia()
.Navigator.mediaSession
Read onlyReturns
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 onlyReturns a boolean value indicating whether the browser is working online.
Navigator.pdfViewerEnabled
Read onlyReturns
true
if the browser can display PDF files inline when navigating to them, andfalse
otherwise.Navigator.permissions
Read onlyReturns a
Permissions
object that can be used to query and update permission status of APIs covered by thePermissions API.Navigator.presentation
Read onlySecure contextReturns a reference to the
Presentation
API.Navigator.scheduling
Read onlyExperimentalReturns a
Scheduling
object for the current document.Navigator.serial
Read onlyExperimentalSecure contextReturns a
Serial
object, which represents the entry point into theWeb Serial API to enable the control of serial ports.Navigator.serviceWorker
Read onlySecure contextReturns a
ServiceWorkerContainer
object, which provides access to registration, removal, upgrade, and communication with theServiceWorker
objects for theassociated document.Navigator.storage
Read onlySecure contextReturns the singleton
StorageManager
object used for managing persistence permissions and estimating available storage on a site-by-site/app-by-app basis.Navigator.usb
Read onlySecure contextReturns a
USB
object for the current document, providing access toWebUSB API functionality.Navigator.userActivation
Read onlyReturns a
UserActivation
object containing information about the current window's user activation state.Navigator.userAgent
Read onlyReturns the user agent string for the current browser.
Navigator.userAgentData
Read onlyExperimentalSecure contextReturns a
NavigatorUAData
object, which gives access to information about the browser and operating system of the user.Navigator.virtualKeyboard
Read onlyExperimentalSecure contextReturns a reference to the
VirtualKeyboard
API, to take control of the on-screen virtual keyboard.Navigator.wakeLock
Read onlySecure contextReturns a
WakeLock
interface you can use to request screen wake locks and prevent screen from dimming, turning off, or showing a screen saver.Navigator.webdriver
Read onlyIndicates whether the user agent is controlled by automation.
Navigator.windowControlsOverlay
Read onlySecure contextReturns 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.Navigator.xr
Read onlyExperimentalSecure contextReturns
XRSystem
object, which represents the entry point into theWebXR API.
Non-standard properties
Navigator.buildID
Read onlyNon-standardReturns 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.globalPrivacyControl
Read onlyExperimentalReturns a boolean indicating a user's consent to their information being shared or sold.
Navigator.standalone
Non-standardReturns a boolean indicating whether the browser is running in standalone mode. Available on Apple's iOS Safari only.
Deprecated properties
Navigator.activeVRDisplays
Read onlyDeprecatedNon-standardReturns an array containing every
VRDisplay
object that is currently presenting (VRDisplay.isPresenting
istrue
).Navigator.appCodeName
Read onlyAlways returns
'Mozilla'
, in any browser.Navigator.appName
Read onlyAlways returns
'Netscape'
, in any browser.Navigator.appVersion
Read onlyReturns the version of the browser as a string. Do not rely on this property to return the correct value.
Navigator.doNotTrack
Read 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.mimeTypes
Read onlyReturns an
MimeTypeArray
listing the MIME types supported by the browser.Navigator.oscpu
Read onlyReturns a string that represents the current operating system.
Navigator.platform
Read onlyReturns a string representing the platform of the browser. Do not rely on this function to return a significant value.
Navigator.plugins
Read onlyReturns a
PluginArray
listing the plugins installed in the browser.Navigator.product
Read onlyAlways returns
'Gecko'
, in any browser.Navigator.productSub
Read onlyReturns either the string
'20030107'
, or'"20100101'
.Navigator.vendor
Read onlyReturns either the empty string,
'Apple Computer Inc.'
, or'Google Inc.'
.Navigator.vendorSub
Read onlyAlways returns the empty string.
Instance methods
Doesn't inherit any method.
Navigator.canShare()
Secure contextReturns
true
if a call toNavigator.share()
would succeed.Navigator.clearAppBadge()
Secure contextClears a badge on the current app's icon and returns a
Promise
that resolves withundefined
.Navigator.deprecatedReplaceInURN()
ExperimentalSubstitutes specified strings inside the mapped URL corresponding to a given opaque URN or
FencedFrameConfig
's internalurl
property. 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
BatteryManager
object that returns information about the battery charging status.Navigator.getGamepads()
returns an array of
Gamepad
objects, 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
Promise
for a MediaKeySystemAccess object.Navigator.requestMIDIAccess()
Secure contextReturns a
Promise
representing 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
Promise
that 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
VRDisplay
objects 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> |
Browser compatibility
Loading…