Navigator Class
https://html.spec.whatwg.org/multipage/system-state.html#the-navigator-object: the identity and the state of the user agent. The values are the ones of a desktop user agent that does not support plug-ins nor a PDF viewer.
public sealed class NavigatorProperties
| Name | Description |
|---|---|
| AppCodeName | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appcodename |
| AppName | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appname |
| AppVersion | The user agent string without its "Mozilla/" prefix (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appversion). |
| Clipboard | Gets the clipboard of the window (https://w3c.github.io/clipboard-apis/#dom-navigator-clipboard). |
| Connection | Gets the network connection of the device (https://wicg.github.io/netinfo/#navigatornetworkinformation-interface), read from NetworkInformationOptions.Provider. |
| CookieEnabled | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-cookieenabled |
| Credentials | Gets the credentials API of the window (https://w3c.github.io/webappsec-credential-management/#dom-navigator-credentials). |
| DeviceMemory | Gets the approximate memory of the device, in GiB (https://www.w3.org/TR/device-memory/#computing-device-memory-value): ClientHintsOptions.DeviceMemory rounded down to a power of two between 0.25 and 8, or 8 when it is not set. The scripts only see it in a secure context. |
| DevicePosture | Gets the posture of the device (https://w3c.github.io/device-posture/#extensions-to-the-navigator-interface). |
| Geolocation | Gets the Geolocation API of the window (https://w3c.github.io/geolocation/#navigator_interface). |
| GlobalPrivacyControl | Gets whether the user does not consent to the sale or sharing of their data (https://w3c.github.io/gpc/#dom-globalprivacycontrol-globalprivacycontrol): see GlobalPrivacyControlOptions. |
| HardwareConcurrency | https://html.spec.whatwg.org/multipage/workers.html#dom-navigator-hardwareconcurrency |
| Ink | Gets the Ink API of the window (https://wicg.github.io/ink-enhancement/#dom-navigator-ink): the presenters of delegated ink trails. |
| Keyboard | Gets the keyboard of the window (https://wicg.github.io/keyboard-lock/#navigator-interface). |
| Language | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language |
| Languages | The same list is returned until the languages change (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-languages). |
| Locks | Gets the lock manager of the window (https://w3c.github.io/web-locks/#dom-navigatorlocks-locks). |
| Login | Gets the Login Status API of the window (https://w3c-fedid.github.io/login-status/#dom-navigator-login). |
| MaxTouchPoints | Gets the maximum number of simultaneous touch contacts of the device (https://w3c.github.io/pointerevents/#dom-navigator-maxtouchpoints): 1 when the device has a touch screen (ViewportOptions.HasTouch, as the touch emulation of Chromium), 0 otherwise (the touch pointers are injected by the host application, see UserInput). |
| MediaCapabilities | Gets the media capabilities of the window (https://w3c.github.io/media-capabilities/#dom-navigator-mediacapabilities). |
| MediaDevices | Gets the media devices of the window (https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices). |
| MediaSession | Gets the media session of the window (https://w3c.github.io/mediasession/#dom-navigator-mediasession). |
| MimeTypes | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-mimetypes |
| OnLine | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-online: false while the browsing context is offline (BrowsingContext.IsOffline). |
| Oscpu | https://html.spec.whatwg.org/multipage/obsolete.html#dom-navigator-oscpu |
| PdfViewerEnabled | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-pdfviewerenabled |
| Permissions | Gets the Permissions API of the window (https://w3c.github.io/permissions/#dom-navigator-permissions). |
| Platform | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform |
| Plugins | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-plugins |
| Product | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-product |
| ProductSub | The value of the compatibility mode "Gecko" (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-productsub). |
| Scheduling | Gets the scheduling of the window (https://wicg.github.io/is-input-pending/#navigator-extension). |
| ServiceWorker | Gets the service workers of the window (https://w3c.github.io/ServiceWorker/#navigator-service-worker). |
| Storage | Gets the storage manager of the window (https://storage.spec.whatwg.org/#dom-navigatorstorage-storage). |
| StorageBuckets | Gets the storage buckets of the origin of the window (https://wicg.github.io/storage-buckets/#dom-navigatorstoragebuckets-storagebuckets). |
| UserActivation | https://html.spec.whatwg.org/multipage/interaction.html#dom-navigator-useractivation |
| UserAgent | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-useragent |
| UserAgentData | Gets the identity of the user agent given by the User-Agent Client Hints (https://wicg.github.io/ua-client-hints/#dom-navigatorua-useragentdata): the values of BrowsingContextOptions.ClientHints. The scripts only see it in a secure context. |
| Vendor | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendor |
| VendorSub | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendorsub |
| VirtualKeyboard | Gets the on-screen keyboard of the window (https://w3c.github.io/virtual-keyboard/#navigator-extension). |
| WakeLock | Gets the Screen Wake Lock API of the window (https://w3c.github.io/screen-wake-lock/#extensions-to-the-navigator-interface). |
AppCodeName
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appcodename
public string AppCodeName { get; }Property value
See also
AppName
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appname
public string AppName { get; }Property value
See also
AppVersion
Navigator.csThe user agent string without its "Mozilla/" prefix (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appversion).
public string AppVersion { get; }Property value
See also
Clipboard
Navigator.csGets the clipboard of the window (https://w3c.github.io/clipboard-apis/#dom-navigator-clipboard).
public Clipboard Clipboard { get; }Connection
NetworkInformation.csGets the network connection of the device (https://wicg.github.io/netinfo/#navigatornetworkinformation-interface), read from NetworkInformationOptions.Provider.
public NetworkInformation Connection { get; }CookieEnabled
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-cookieenabled
public bool CookieEnabled { get; }Property value
See also
Credentials
CredentialsContainer.csGets the credentials API of the window (https://w3c.github.io/webappsec-credential-management/#dom-navigator-credentials).
public CredentialsContainer Credentials { get; }DeviceMemory
NetworkInformation.csGets the approximate memory of the device, in GiB (https://www.w3.org/TR/device-memory/#computing-device-memory-value): ClientHintsOptions.DeviceMemory rounded down to a power of two between 0.25 and 8, or 8 when it is not set. The scripts only see it in a secure context.
public double DeviceMemory { get; }Property value
DevicePosture
DevicePosture.csGets the posture of the device (https://w3c.github.io/device-posture/#extensions-to-the-navigator-interface).
public DevicePosture DevicePosture { get; }Property value
See also
Geolocation
Geolocation.csGets the Geolocation API of the window (https://w3c.github.io/geolocation/#navigator_interface).
public Geolocation Geolocation { get; }GlobalPrivacyControl
NetworkInformation.csGets whether the user does not consent to the sale or sharing of their data (https://w3c.github.io/gpc/#dom-globalprivacycontrol-globalprivacycontrol): see GlobalPrivacyControlOptions.
public bool GlobalPrivacyControl { get; }HardwareConcurrency
Navigator.cshttps://html.spec.whatwg.org/multipage/workers.html#dom-navigator-hardwareconcurrency
public ulong HardwareConcurrency { get; }Ink
Navigator.csGets the Ink API of the window (https://wicg.github.io/ink-enhancement/#dom-navigator-ink): the presenters of delegated ink trails.
public Ink Ink { get; }Keyboard
KeyboardLock.csGets the keyboard of the window (https://wicg.github.io/keyboard-lock/#navigator-interface).
public Keyboard Keyboard { get; }Language
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language
public string Language { get; }Property value
See also
Languages
Navigator.csThe same list is returned until the languages change (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-languages).
public IReadOnlyList<string> Languages { get; }Locks
Navigator.csGets the lock manager of the window (https://w3c.github.io/web-locks/#dom-navigatorlocks-locks).
public LockManager Locks { get; }Login
LoginStatus.csGets the Login Status API of the window (https://w3c-fedid.github.io/login-status/#dom-navigator-login).
public NavigatorLogin Login { get; }MaxTouchPoints
Navigator.csGets the maximum number of simultaneous touch contacts of the device (https://w3c.github.io/pointerevents/#dom-navigator-maxtouchpoints): 1 when the device has a touch screen (ViewportOptions.HasTouch, as the touch emulation of Chromium), 0 otherwise (the touch pointers are injected by the host application, see UserInput).
public int MaxTouchPoints { get; }MediaCapabilities
MediaCapabilities.csGets the media capabilities of the window (https://w3c.github.io/media-capabilities/#dom-navigator-mediacapabilities).
public MediaCapabilities MediaCapabilities { get; }MediaDevices
MediaDevices.csGets the media devices of the window (https://w3c.github.io/mediacapture-main/#dom-navigator-mediadevices).
public MediaDevices MediaDevices { get; }Property value
See also
MediaSession
MediaSession.csGets the media session of the window (https://w3c.github.io/mediasession/#dom-navigator-mediasession).
public MediaSession MediaSession { get; }MimeTypes
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-mimetypes
public PluginMimeTypeArray MimeTypes { get; }OnLine
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-online: false while the browsing context is offline (BrowsingContext.IsOffline).
public bool OnLine { get; }Property value
See also
Oscpu
Navigator.cshttps://html.spec.whatwg.org/multipage/obsolete.html#dom-navigator-oscpu
public string Oscpu { get; }Property value
See also
PdfViewerEnabled
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-pdfviewerenabled
public bool PdfViewerEnabled { get; }Permissions
Navigator.csGets the Permissions API of the window (https://w3c.github.io/permissions/#dom-navigator-permissions).
public Permissions Permissions { get; }Platform
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform
public string Platform { get; }Property value
See also
Plugins
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-plugins
public PluginArray Plugins { get; }Product
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-product
public string Product { get; }Property value
See also
ProductSub
Navigator.csThe value of the compatibility mode "Gecko" (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-productsub).
public string ProductSub { get; }Property value
See also
Scheduling
InputPending.csGets the scheduling of the window (https://wicg.github.io/is-input-pending/#navigator-extension).
public Scheduling Scheduling { get; }ServiceWorker
Navigator.csGets the service workers of the window (https://w3c.github.io/ServiceWorker/#navigator-service-worker).
public ServiceWorkerContainer ServiceWorker { get; }Property value
Exceptions
DomException- A
SecurityErrorwhen the origin of the document is opaque (e.g. a sandboxed document), as in the browsers.
See also
Storage
Navigator.csGets the storage manager of the window (https://storage.spec.whatwg.org/#dom-navigatorstorage-storage).
public StorageManager Storage { get; }StorageBuckets
StorageBuckets.csGets the storage buckets of the origin of the window (https://wicg.github.io/storage-buckets/#dom-navigatorstoragebuckets-storagebuckets).
public StorageBucketManager StorageBuckets { get; }UserActivation
Navigator.cshttps://html.spec.whatwg.org/multipage/interaction.html#dom-navigator-useractivation
public UserActivation UserActivation { get; }UserAgent
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-useragent
public string UserAgent { get; }Property value
See also
UserAgentData
Navigator.UserAgentData.csGets the identity of the user agent given by the User-Agent Client Hints (https://wicg.github.io/ua-client-hints/#dom-navigatorua-useragentdata): the values of BrowsingContextOptions.ClientHints. The scripts only see it in a secure context.
public NavigatorUAData UserAgentData { get; }Property value
See also
Vendor
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendor
public string Vendor { get; }Property value
See also
VendorSub
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendorsub
public string VendorSub { get; }Property value
See also
VirtualKeyboard
VirtualKeyboard.csGets the on-screen keyboard of the window (https://w3c.github.io/virtual-keyboard/#navigator-extension).
public VirtualKeyboard VirtualKeyboard { get; }Property value
See also
WakeLock
WakeLock.csGets the Screen Wake Lock API of the window (https://w3c.github.io/screen-wake-lock/#extensions-to-the-navigator-interface).
public WakeLock WakeLock { get; }Methods
| Name | Description |
|---|---|
| CanShare(ShareData?) | Returns whether Navigator.Share would accept the data (https://w3c.github.io/web-share/#canshare-method): false when the document is not fully active, is not allowed to use the web-share feature, or the data is not valid. |
| ClearAppBadge() | Clears the badge of the application (https://w3c.github.io/badging/#clearappbadge-method), as setAppBadge(0). |
| GetBattery() | Returns the battery status of the device (https://w3c.github.io/battery/#the-getbattery-method), read from BatteryStatusOptions.Provider. It returns the same task at each call. The task fails with a NotAllowedError DomException when the document is not allowed to use the battery feature. |
| JavaEnabled() | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-javaenabled |
| RegisterProtocolHandler(string, string) | Validates the parameters, then registers the handler in ProtocolHandlerOptions.Registry when the registerProtocolHandler() automation mode of the document (Document.ProtocolHandlerAutomationMode) or the user (ProtocolHandlerOptions.RequestRegistration) accepts it (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-registerprotocolhandler). Without BrowsingContextOptions.ProtocolHandlers, the handlers are not registered. The registration of a prerendering document is deferred until its activation (https://wicg.github.io/nav-speculation/prerendering.html#patch-rph). |
| RequestMediaKeySystemAccess(string, IReadOnlyList<MediaKeySystemConfiguration>) | Requests the access to a key system with one of the configurations (https://w3c.github.io/encrypted-media/#navigator-extension-requestmediakeysystemaccess). The library implements Clear Key (org.w3.clearkey), for the media types that the media backend of the browsing context plays (BrowsingContextOptions.MediaBackend). The task fails with a NotSupportedError when the key system or none of the configurations is supported, and with a SecurityError when the document is not allowed to use the encrypted-media feature. In a prerendering document, the request starts when the document is activated. |
| SendBeacon(string, object?) | Sends data to url with a POST request that is sent even if the document is unloaded (https://w3c.github.io/beacon/#sendbeacon-method). data is null, a Blob, a byte array, a FormData, a UrlSearchParams or a string. The request is a keepalive request: the method returns false when its body exceeds the quota of the inflight keepalive requests of the document (64 KiB), or when the request is blocked as mixed content or by the Content Security Policy. The response is ignored. |
| SetAppBadge(ulong?) | Sets the badge of the application (https://w3c.github.io/badging/#setappbadge-method), with BadgingOptions.SetBadge: a flag without argument, a number, or nothing when the number is 0. The task fails with an InvalidStateError DomException when the document is not fully active, and a SecurityError when it is not same origin with the top-level document. |
| Share(ShareData?) | Shares data with a target chosen by the user (https://w3c.github.io/web-share/#share-method), with BrowsingContextOptions.Share. The task fails with an InvalidStateError DomException when the document is not fully active or a share is in progress, a NotAllowedError when the document is not allowed to use the web-share feature or has no transient activation, a TypeErrorException when the data is not valid, and an AbortError when there is no share target or the user cancels. |
| TaintEnabled() | https://html.spec.whatwg.org/multipage/obsolete.html#dom-navigator-taintenabled |
| UnregisterProtocolHandler(string, string) | https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-unregisterprotocolhandler: removes the handler from ProtocolHandlerOptions.Registry. The removal of a prerendering document is deferred until its activation (https://wicg.github.io/nav-speculation/prerendering.html#patch-rph). |
| Vibrate(IReadOnlyList<uint>) | Vibrates the device with a pattern (https://w3c.github.io/vibration/#vibrate-method), with BrowsingContextOptions.Vibrate: the durations alternate between the vibrations and the pauses. Returns false when the document is hidden or has no sticky activation, true otherwise. An empty pattern, or a pattern of zeros, cancels the current vibration. |
| Vibrate(uint) | Vibrates the device with a pattern (https://w3c.github.io/vibration/#vibrate-method), with BrowsingContextOptions.Vibrate: the durations alternate between the vibrations and the pauses. Returns false when the document is hidden or has no sticky activation, true otherwise. An empty pattern, or a pattern of zeros, cancels the current vibration. |
ClearAppBadge()
Badging.csClears the badge of the application (https://w3c.github.io/badging/#clearappbadge-method), as setAppBadge(0).
public Task ClearAppBadge()GetBattery()
BatteryStatus.csReturns the battery status of the device (https://w3c.github.io/battery/#the-getbattery-method), read from BatteryStatusOptions.Provider. It returns the same task at each call. The task fails with a NotAllowedError DomException when the document is not allowed to use the battery feature.
public Task<BatteryManager> GetBattery()JavaEnabled()
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-javaenabled
public bool JavaEnabled()RegisterProtocolHandler(string, string)
Navigator.csValidates the parameters, then registers the handler in ProtocolHandlerOptions.Registry when the registerProtocolHandler() automation mode of the document (Document.ProtocolHandlerAutomationMode) or the user (ProtocolHandlerOptions.RequestRegistration) accepts it (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-registerprotocolhandler). Without BrowsingContextOptions.ProtocolHandlers, the handlers are not registered. The registration of a prerendering document is deferred until its activation (https://wicg.github.io/nav-speculation/prerendering.html#patch-rph).
Parameters
See also
RequestMediaKeySystemAccess(string, IReadOnlyList<MediaKeySystemConfiguration>)
MediaKeySystemAccess.csRequests the access to a key system with one of the configurations (https://w3c.github.io/encrypted-media/#navigator-extension-requestmediakeysystemaccess). The library implements Clear Key (org.w3.clearkey), for the media types that the media backend of the browsing context plays (BrowsingContextOptions.MediaBackend). The task fails with a NotSupportedError when the key system or none of the configurations is supported, and with a SecurityError when the document is not allowed to use the encrypted-media feature. In a prerendering document, the request starts when the document is activated.
public Task<MediaKeySystemAccess> RequestMediaKeySystemAccess(string keySystem, IReadOnlyList<MediaKeySystemConfiguration> supportedConfigurations)Parameters
keySystemstring- The key system (case-sensitive).
supportedConfigurationsIReadOnlyList<MediaKeySystemConfiguration>- The configurations, by order of preference.
Returns
See also
SendBeacon(string, object?)
Navigator.csSends data to url with a POST request that is sent even if the document is unloaded (https://w3c.github.io/beacon/#sendbeacon-method). data is null, a Blob, a byte array, a FormData, a UrlSearchParams or a string. The request is a keepalive request: the method returns false when its body exceeds the quota of the inflight keepalive requests of the document (64 KiB), or when the request is blocked as mixed content or by the Content Security Policy. The response is ignored.
Parameters
Returns
Exceptions
TypeErrorException- The URL is not a valid http or https URL, or the data is a stream.
See also
SetAppBadge(ulong?)
Badging.csSets the badge of the application (https://w3c.github.io/badging/#setappbadge-method), with BadgingOptions.SetBadge: a flag without argument, a number, or nothing when the number is 0. The task fails with an InvalidStateError DomException when the document is not fully active, and a SecurityError when it is not same origin with the top-level document.
TaintEnabled()
Navigator.cshttps://html.spec.whatwg.org/multipage/obsolete.html#dom-navigator-taintenabled
public bool TaintEnabled()UnregisterProtocolHandler(string, string)
Navigator.cshttps://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-unregisterprotocolhandler: removes the handler from ProtocolHandlerOptions.Registry. The removal of a prerendering document is deferred until its activation (https://wicg.github.io/nav-speculation/prerendering.html#patch-rph).
Parameters
See also
Vibrate overloads
Vibrate(IReadOnlyList<uint>)
Vibration.csVibrates the device with a pattern (https://w3c.github.io/vibration/#vibrate-method), with BrowsingContextOptions.Vibrate: the durations alternate between the vibrations and the pauses. Returns false when the document is hidden or has no sticky activation, true otherwise. An empty pattern, or a pattern of zeros, cancels the current vibration.
public bool Vibrate(IReadOnlyList<uint> pattern)Parameters
patternIReadOnlyList<uint>- The durations of the vibrations and the pauses, in milliseconds.
Returns
See also
Vibrate(uint)
Vibration.csVibrates the device with a pattern (https://w3c.github.io/vibration/#vibrate-method), with BrowsingContextOptions.Vibrate: the durations alternate between the vibrations and the pauses. Returns false when the document is hidden or has no sticky activation, true otherwise. An empty pattern, or a pattern of zeros, cancels the current vibration.
Constants
| Name | Description |
|---|---|
| DefaultUserAgent | The user agent string of the library (navigator.userAgent when BrowsingContextOptions.UserAgent is null), also sent in the User-Agent header by the hosts that follow it. |
DefaultUserAgent
The user agent string of the library (navigator.userAgent when BrowsingContextOptions.UserAgent is null), also sent in the User-Agent header by the hosts that follow it.
public const string DefaultUserAgent = "Mozilla/5.0 (Meziantou.Framework.WebPlatform)"