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.
Value members
Concrete methods
The Clipboard API adds to the Navigator interface the read-only clipboard property, which returns the Clipboard object used to read and write the clipboard's contents. The Clipboard API can be used to implement cut, copy, and paste features within a web application.
The Clipboard API adds to the Navigator interface the read-only clipboard property, which returns the Clipboard object used to read and write the clipboard's contents. The Clipboard API can be used to implement cut, copy, and paste features within a web application.
Use of the asynchronous clipboard read and write methods requires that the user grant the web site or app permission to access the clipboard. This permission must be obtained from the Permissions API using the "clipboard-read" and/or "clipboard-write" permissions.
The Navigator.mediaDevices read-only property returns a MediaDevices object, which provides access to connected media input devices like cameras and microphones, as well as screen sharing.
The Navigator.mediaDevices read-only property returns a MediaDevices object, which provides access to connected media input devices like cameras and microphones, as well as screen sharing.
- See also:
The navigator.sendBeacon() method can be used to asynchronously transfer small HTTP data from the User Agent to a web server.
The navigator.sendBeacon() method can be used to asynchronously transfer small HTTP data from the User Agent to a web server.
- Value parameters:
- data
The data parameter is the ArrayBufferView, Blob, DOMString, or FormData data that is to be transmitted.
- url
The url parameter indicates the resolved URL where the data is to be transmitted.
Inherited methods
Returns the name of the browser. The HTML5 specification also allows any browser to return "Netscape" here, for compatibility reasons.
Returns the name of the browser. The HTML5 specification also allows any browser to return "Netscape" here, for compatibility reasons.
- Inherited from:
- NavigatorID
Returns the version of the browser as a string. It may be either a plain version number, like "5.0", or a version number followed by more detailed information. The HTML5 specification also allows any browser to return "4.0" here, for compatibility reasons.
Returns the version of the browser as a string. It may be either a plain version number, like "5.0", or a version number followed by more detailed information. The HTML5 specification also allows any browser to return "4.0" here, for compatibility reasons.
- Inherited from:
- NavigatorID
The NavigatorGeolocation.geolocation read-only property returns a Geolocation object that gives Web content access to the location of the device. This allows a Web site or app offer customized results based on the user's location.
The NavigatorGeolocation.geolocation read-only property returns a Geolocation object that gives Web content access to the location of the device. This allows a Web site or app offer customized results based on the user's location.
- Inherited from:
- NavigatorGeolocation
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 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.
- Inherited from:
- NavigatorLanguage
Returns a Array of DOMStrings representing the the user's preferred languages. The language is described using BCP 47 language tags. The null value is returned when this is unknown.
Returns a Array of DOMStrings representing the the user's preferred languages. The language is described using BCP 47 language tags. The null value is returned when this is unknown.
- Inherited from:
- NavigatorLanguage
A LockManager object which provides methods for requesting a new Lock object and querying for an existing Lock object.
A LockManager object which provides methods for requesting a new Lock object and querying for an existing Lock object.
- Inherited from:
- NavigatorLocks
Returns the online status of the browser. The property returns a boolean value, with true for being online and false for being offline. The property sends updates whenever the browser's ability to connect to the network changes. The update occurs when the user follows links or when a script requests a remote page. For example, the property should return false when users click links soon after they lose internet connection.
Returns the online status of the browser. The property returns a boolean value, with true for being online and false for being offline. The property sends updates whenever the browser's ability to connect to the network changes. The update occurs when the user follows links or when a script requests a remote page. For example, the property should return false when users click links soon after they lose internet connection.
- Inherited from:
- NavigatorOnLine
Returns a string representing the platform of the browser.
Returns a string representing the platform of the browser.
- Inherited from:
- NavigatorID
The Navigator method registerProtocolHandler() lets websites register their ability to open or handle particular URL schemes (aka protocols).
The Navigator method registerProtocolHandler() lets websites register their ability to open or handle particular URL schemes (aka protocols).
For example, this API lets webmail sites open mailto: URLs, or VoIP sites open tel: URLs.
- Value parameters:
- scheme
A string containing the permitted scheme for the protocol that the site wishes to handle. For example, you can register to handle SMS text message links by passing the "sms" scheme.
- url
A string containing the URL of the handler. This URL must include %s, as a placeholder that will be replaced with the escaped URL to be handled.
- Returns:
undefined
- Throws:
- DOMException.SECURITY_ERR
The user agent blocked the registration. This might happen if:
- The registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:, etc.)
- The handler URL's origin does not match the origin of the page calling this API.
- The browser requires that this function is called from a secure context.
- The browser requires that the handler's URL be over HTTPS.
- DOMException.SYNTAX_ERR
The %s placeholder is missing from the handler URL
- See also:
- Inherited from:
- NavigatorContentUtils
The Navigator method unregisterProtocolHandler() removes a protocol handler for a given URL scheme.
The Navigator method unregisterProtocolHandler() removes a protocol handler for a given URL scheme.
This method is the inverse of registerProtocolHandler().
- Value parameters:
- scheme
A string containing the permitted scheme in the protocol handler that will be unregistered. For example, you can unregister the handler for SMS text message links by passing the "sms" scheme.
- url
A string containing the URL of the handler. This URL should match the one that was used to register the handler (e.g. it must include %s).
- Returns:
undefined
- Throws:
- DOMException.SECURITY_ERR
The user agent blocked unregistration. This might happen if:
- The registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:, etc.)
- The handler URL's origin does not match the origin of the page calling this API.
- The browser requires that this function is called from a secure context.
- The browser requires that the handler's URL be over HTTPS.
- DOMException.SYNTAX_ERR
The %s placeholder is missing from the handler URL
- See also:
- Inherited from:
- NavigatorContentUtils
Returns the user agent string for the current browser.
Returns the user agent string for the current browser.
- Inherited from:
- NavigatorID
Vibrate the device in the given pattern.
Vibrate the device in the given pattern.
- Value parameters:
- pattern
the pattern to vibrate. The first number is the initial duration, the subsequent a delay of silence, and so on.
- Inherited from:
- NavigatorVibration
Vibrate the device for the specified number of milliseconds.
Vibrate the device for the specified number of milliseconds.
- Inherited from:
- NavigatorVibration
Concrete fields
The Navigator.serviceWorker read-only property returns a ServiceWorkerContainer object, which provides access to registration, removal, upgrade, and communication with the ServiceWorker objects for the associated document.
The Navigator.serviceWorker read-only property returns a ServiceWorkerContainer object, which provides access to registration, removal, upgrade, and communication with the ServiceWorker objects for the associated document.