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 |
| 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). |
| 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). |
| 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). |
| 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
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; }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; }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; }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; the handlers are not registered as there is no user to accept them (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-registerprotocolhandler). |
| 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 |
| 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; the handlers are not registered as there is no user to accept them (https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-registerprotocolhandler).
Parameters
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.csVibrate 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)"