Navigator - Web APIs | MDN (original) (raw)
Baseline
Widely available *
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.
Instance properties
Doesn't inherit any properties.
Standard properties
Navigator.bluetooth Read only Experimental Secure context
Returns a Bluetooth object for the current document, providing access to Web Bluetooth API functionality.
Navigator.clipboard Read only Secure context
Returns a Clipboard object that provides read and write access to the system clipboard.
Navigator.connection Read only
Returns a NetworkInformation object containing information about the network connection of a device.
Navigator.contacts Read only Experimental Secure context
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.cookieEnabled Read only
Returns false if setting a cookie will be ignored and true otherwise.
Navigator.credentials Read only Secure context
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 Secure context
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.devicePosture Read only Experimental
Returns 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 only
Returns a Geolocation object allowing accessing the location of the device.
Navigator.gpu Read only Experimental Secure context
Returns the GPU object for the current browsing context. The entry point for the WebGPU API.
Navigator.hardwareConcurrency Read only
Returns the number of logical processor cores available.
Navigator.hid Read only Experimental Secure context
Returns an HID object providing methods for connecting to HID devices, listing attached HID devices, and event handlers for connected HID devices.
Navigator.ink Read only Experimental
Returns an Ink object for the current document, providing access to Ink API functionality.
Navigator.keyboard Read only Experimental Secure context
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 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 only
Returns an array of strings representing the languages known to the user, by order of preference.
Navigator.locks Read only Secure context
Returns a LockManager object that provides methods for requesting a new Lock object and querying for an existing Lock object.
Navigator.login Read only Secure context
Provides 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. See Federated Credential Management (FedCM) API for more details.
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 Secure context
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.pdfViewerEnabled Read only
Returns true
if the browser can display PDF files inline when navigating to them, and false
otherwise.
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 Secure context
Returns a reference to the Presentation API.
Navigator.scheduling Read only Experimental
Returns a Scheduling object for the current document.
Navigator.serial Read only Experimental Secure context
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 Secure context
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 Secure context
Returns 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 only Secure context
Returns a USB object for the current document, providing access to WebUSB API functionality.
Navigator.userActivation Read only
Returns a UserActivation object containing information about the current window's user activation state.
Navigator.userAgent Read only
Returns the user agent string for the current browser.
Navigator.userAgentData Read only Experimental Secure context
Returns a NavigatorUAData object, which gives access to information about the browser and operating system of the user.
Navigator.virtualKeyboard Read only Experimental Secure context
Returns a reference to the VirtualKeyboard API, to take control of the on-screen virtual keyboard.
Navigator.wakeLock Read only Secure context
Returns 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 only
Indicates whether the user agent is controlled by automation.
Navigator.windowControlsOverlay Read only Secure context
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.
Navigator.xr Read only Experimental Secure context
Returns XRSystem object, which represents the entry point into the WebXR API.
Non-standard properties
Navigator.buildID Read only Non-standard
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.globalPrivacyControl Read only Experimental
Returns a boolean indicating a user's consent to their information being shared or sold.
Navigator.standalone
Non-standard
Returns a boolean indicating whether the browser is running in standalone mode. Available on Apple's iOS Safari only.
Deprecated properties
Navigator.activeVRDisplays Read only Deprecated Non-standard
Returns an array containing every VRDisplay object that is currently presenting (VRDisplay.isPresenting is true
).
Navigator.appCodeName Read only Deprecated
Always returns 'Mozilla'
, in any browser.
Navigator.appName Read only Deprecated
Always returns 'Netscape'
, in any browser.
Navigator.appVersion Read only Deprecated
Returns the version of the browser as a string. Do not rely on this property to return the correct value.
Navigator.doNotTrack Read only Deprecated Non-standard
Reports 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 only Deprecated
Returns an MimeTypeArray listing the MIME types supported by the browser.
Navigator.oscpu Read only Deprecated
Returns a string that represents the current operating system.
Navigator.platform Read only Deprecated
Returns a string representing the platform of the browser. Do not rely on this function to return a significant value.
Navigator.plugins Read only Deprecated
Returns a PluginArray listing the plugins installed in the browser.
Navigator.product Read only Deprecated
Always returns 'Gecko'
, in any browser.
Navigator.productSub Read only Deprecated
Returns either the string '20030107'
, or '"20100101'
.
Navigator.vendor Read only Deprecated
Returns either the empty string, 'Apple Computer Inc.'
, or 'Google Inc.'
.
Navigator.vendorSub Read only Deprecated
Always returns the empty string.
Instance methods
Doesn't inherit any method.
Navigator.canShare() Secure context
Returns true
if a call to Navigator.share()
would succeed.
Navigator.clearAppBadge() Secure context
Clears a badge on the current app's icon and returns a Promise that resolves with undefined.
Navigator.deprecatedReplaceInURN() Experimental
Substitutes specified strings inside the mapped URL corresponding to a given opaque URN or FencedFrameConfig
's internal url
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 to privacy sandbox APIs.
Navigator.getAutoplayPolicy() Experimental
Returns a value indicating whether the specified media element, audio context, or media feature "type" is allowed to autoplay.
Navigator.getBattery() Secure context
Returns a promise that resolves with a BatteryManager object that returns information about the battery charging status.
returns an array of Gamepad objects, one for each gamepad connected to the device.
Returns a promise that resolves with an array of objects representing any related native or Progressive Web Applications that the user has installed.
Navigator.registerProtocolHandler() Secure context
Allows websites to register themselves as a possible handler for a given protocol.
Navigator.requestMediaKeySystemAccess() Secure context
Returns a Promise for a MediaKeySystemAccess object.
Navigator.requestMIDIAccess() Secure context
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.
Navigator.setAppBadge() Secure context
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.
Navigator.unregisterProtocolHandler() Secure context
Unregister a website that is a handler for a given protocol.
Deprecated methods
Navigator.getUserMedia() Deprecated Secure context
After having prompted the user for permission, returns the audio or video stream associated to a camera or microphone on the local computer.
Navigator.getVRDisplays() Deprecated Non-standard
Returns a promise that resolves to an array of VRDisplay objects representing any available VR devices connected to the computer.
Navigator.javaEnabled() Deprecated
Always returns false.
Navigator.taintEnabled() Deprecated
Returns false
. JavaScript taint/untaint functions removed in JavaScript 1.2.
Specifications
Specification |
---|
HTML # the-navigator-object |