Table of Contents

Class Navigator

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

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.

[Value("Navigator")]
public class Navigator
Inheritance
Navigator
Inherited Members

Remarks

A Navigator object can be retrieved using the read-only Navigator property.

See also on MDN

Constructors

Navigator()

public Navigator()

Properties

AudioSession

[Value("audioSession")]
public AudioSession AudioSession { get; }

Property Value

AudioSession

Bluetooth

NOTE
Experimental
The bluetooth read-only property of the Navigator interface returns a Bluetooth object for the current document, providing access to Web Bluetooth API functionality.
[Value("bluetooth")]
public Bluetooth Bluetooth { get; }

Property Value

Bluetooth

A Bluetooth object.

Remarks

Clipboard

The clipboard read-only property of the Navigator interface returns a Clipboard object used to read and write the clipboard's contents.

[Value("clipboard")]
public Clipboard Clipboard { get; }

Property Value

Clipboard

The Clipboard object used to access the system clipboard.

Remarks

This is the entry point to the Clipboard API, which can be used to implement cut, copy, and paste features within a web application.

See also on MDN

Contacts

NOTE
Experimental
The contacts read-only property of the
Navigator interface 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.
[Value("contacts")]
public ContactsManager Contacts { get; }

Property Value

ContactsManager

A 'ContactsManager' object. Two successive calls return the same object.

Remarks

Credentials

The credentials read-only property of the Navigator interface returns the CredentialsContainer object associated with the current document, which exposes methods to request credentials. The CredentialsContainer interface also notifies the user agent when an interesting event occurs, such as a successful sign-in or sign-out. This interface can be used for feature detection.

[Value("credentials")]
public CredentialsContainer Credentials { get; }

Property Value

CredentialsContainer

A CredentialsContainer object.

Remarks

DeprecatedRunAdAuctionEnforcesKAnonymity

[Value("deprecatedRunAdAuctionEnforcesKAnonymity")]
public bool DeprecatedRunAdAuctionEnforcesKAnonymity { get; }

Property Value

bool

DevicePosture

NOTE
Experimental
The Navigator.devicePosture read-only property 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.
[Value("devicePosture")]
public DevicePosture DevicePosture { get; }

Property Value

DevicePosture

A DevicePosture object.

Remarks

Geolocation

The Navigator.geolocation read-only property returns a
Geolocation object that gives Web content access to the location of the
device. This allows a website or app to offer customized results based on the user's
location.

[Value("geolocation")]
public Geolocation Geolocation { get; }

Property Value

Geolocation

A Geolocation object.

Remarks

NOTE

For security reasons, when a web page tries to access location
information, the user is notified and asked to grant permission. Be aware that each
browser has its own policies and methods for requesting this permission.

-Using the Geolocation API

See also on MDN

Hid

NOTE
Experimental
The Navigator.hid
read-only property returns an HID object providing methods for accessing HID device connections and events that fire when the user agent connects to or disconnects from a device.
[Value("hid")]
public HID Hid { get; }

Property Value

HID

An HID object.

Remarks

Where a defined Permissions Policy blocks WebHID usage, the Navigator.hid property will not be available.

-WebHID API

See also on MDN

Ink

NOTE
Experimental
The ink read-only property of the Navigator interface returns an Ink object for the current document, providing access to Ink API functionality.
[Value("ink")]
public Ink Ink { get; }

Property Value

Ink

An 'Ink' object.

Remarks

Keyboard

NOTE
Experimental
The keyboard read-only property
of the Navigator interface returns a 'Keyboard' object
which provides access to functions that retrieve keyboard layout maps and toggle
capturing of key presses from the physical keyboard.
[Value("keyboard")]
public Keyboard Keyboard { get; }

Property Value

Keyboard

A 'Keyboard' object.

Remarks

Login

The login read-only property of the Navigator interface provides access to the browser's NavigatorLogin object, which a federated identity provider (IdP) can use to set its login status when a user signs into or out of the IdP.

[Value("login")]
public NavigatorLogin Login { get; }

Property Value

NavigatorLogin

A NavigatorLogin object.

Remarks

Managed

[Value("managed")]
public NavigatorManagedData Managed { get; }

Property Value

NavigatorManagedData

MaxTouchPoints

The maxTouchPoints read-only property of the
Navigator interface returns the maximum number of simultaneous touch
contact points that are supported by the current device.

[Value("maxTouchPoints")]
public long MaxTouchPoints { get; }

Property Value

long

A number.

Remarks

MediaCapabilities

The mediaCapabilities read-only property of the Navigator interface references a MediaCapabilities object that can expose information about the decoding and encoding capabilities for a given media format and output capabilities.

[Value("mediaCapabilities")]
public MediaCapabilities MediaCapabilities { get; }

Property Value

MediaCapabilities

A MediaCapabilities object.

Remarks

MediaDevices

The mediaDevices read-only property of the Navigator interface returns a MediaDevices object, which provides access to connected media input devices like cameras and microphones, as well as screen sharing.

[Value("mediaDevices")]
public MediaDevices MediaDevices { get; }

Property Value

MediaDevices

The MediaDevices singleton object. Usually, you just use this object's members directly, such as by calling GetUserMedia(MediaStreamConstraints).

Remarks

-Media Capture and Streams API: The entry point to the documentation about the entire Media Capture and Streams API.
-WebRTC API: Documentation about the WebRTC API, which is closely related.

See also on MDN

MediaSession

The mediaSession read-only property of the Navigator
interface returns a MediaSession
object that can be used to share with the browser metadata and other information about
the current playback state of media being handled by a document.

[Value("mediaSession")]
public MediaSession MediaSession { get; }

Property Value

MediaSession

A MediaSession object the current document can use to share information
about media it's playing and its current playback status. This information can include
typical metadata such as the title, artist, and album name of the song being played as
well as potentially one or more images containing things like album art, artist photos,
and so forth.

Remarks

This
information may, in turn, be shared with the device and/or operating system in order to
a device's standard media control user experience to describe and control the playback
of the media.

In addition, the MediaSession interface provides the
SetActionHandler(MediaSessionAction, MediaSessionActionHandler?) method, which lets
you receive events when the user engages device controls such as either onscreen or
physical play, pause, seek, and other similar controls. An internet radio app, for
example, can use setActionHandler() to let the media controls on a keyboard
or elsewhere on the user's device be used to control the app's media playback.

See also on MDN

Permissions

The permissions read-only property of the Navigator interface returns a
Permissions object that can be used to query and update permission
status of APIs covered by the Permissions API.

[Value("permissions")]
public Permissions Permissions { get; }

Property Value

Permissions

A Permissions object.

Remarks

Preferences

[Value("preferences")]
public PreferenceManager Preferences { get; }

Property Value

PreferenceManager

Presentation

The presentation read-only property of Navigator serves as the entry
point for the Presentation API and
returns a reference to Presentation object.

[Value("presentation")]
public Presentation Presentation { get; }

Property Value

Presentation

A reference to Presentation object.

Remarks

ProtectedAudience

[Value("protectedAudience")]
public ProtectedAudience ProtectedAudience { get; }

Property Value

ProtectedAudience

Scheduling

NOTE
Experimental
The scheduling read-only property of the Navigator interface returns a Scheduling object for the current document, which provides methods and properties to control scheduling tasks.
[Value("scheduling")]
public Scheduling Scheduling { get; }

Property Value

Scheduling

A Scheduling object.

Remarks

WARNING

The Scheduling interface (which includes the IsInputPending(IsInputPendingOptions) method) has been superseded by the Scheduler interface, the features of which are better designed for addressing scheduling tasks. See Don't use isInputPending() for more details.

-Scheduler interface
-{{domxref("Prioritized_task_scheduling_api", "Prioritized Task Scheduling API", "", "nocode")}}
-Faster input events with Facebook's first browser API contribution on engineering.fb.com (2019)
-Better JS scheduling with isInputPending() on developer.chrome.com (2020)
-Optimizing long tasks on web.dev (2022)

See also on MDN

Serial

NOTE
Experimental
The serial read-only property of the Navigator interface returns a Serial object which represents the entry point into the Web Serial API.
[Value("serial")]
public Serial Serial { get; }

Property Value

Serial

A Serial object.

Remarks

When getting, the same instance of the Serial object will always be returned.

-Read from and write to a serial port
-Getting started with the web serial API

See also on MDN

ServiceWorker

The serviceWorker read-only property of the Navigator interface returns the ServiceWorkerContainer object for the associated document, which provides access to registration, removal, upgrade, and communication with the ServiceWorker.

[Value("serviceWorker")]
public ServiceWorkerContainer ServiceWorker { get; }

Property Value

ServiceWorkerContainer

ServiceWorkerContainer.

Remarks

The feature may not be available in private mode.

Note that a worker can similarly access the ServiceWorkerContainer for a document using ServiceWorker.

-{{domxref("Service Worker API", "", "", "nocode")}}
-Using Service Workers

See also on MDN

Usb

The usb read-only property of the Navigator interface returns a USB object for the current document, providing access to WebUSB API functionality.

[Value("usb")]
public USB Usb { get; }

Property Value

USB

A 'USB' object.

Remarks

UserActivation

The read-only userActivation property of the Navigator interface returns a UserActivation object which contains information about the current window's user activation state.

[Value("userActivation")]
public UserActivation UserActivation { get; }

Property Value

UserActivation

A UserActivation object.

Remarks

VirtualKeyboard

NOTE
Experimental
The virtualKeyboard read-only property
of the Navigator interface returns a reference to the VirtualKeyboard instance object.
[Value("virtualKeyboard")]
public VirtualKeyboard VirtualKeyboard { get; }

Property Value

VirtualKeyboard

A VirtualKeyboard object you can use to opt-out of the automatic virtual keyboard behavior, show or hide the virtual keyboard programmatically, and get the current position and size of the virtual keyboard.

Remarks

The {{domxref("VirtualKeyboard_API", "VirtualKeyboard API", "", "nocode")}} gives developers control over the layout of their applications when the on-screen virtual keyboard appears and disappears on devices such as tablets, mobile phones, or other devices where a hardware keyboard may not be available.

See also on MDN

WakeLock

The wakeLock read-only property of the Navigator interface returns a WakeLock interface that allows a document to acquire a screen wake lock.
While a screen wake lock is active, the user agent will try to prevent the device from dimming the screen, turning it off completely, or showing a screensaver.

[Value("wakeLock")]
public WakeLock WakeLock { get; }

Property Value

WakeLock

Remarks

WindowControlsOverlay

The windowControlsOverlay read-only property of the Navigator
interface returns the WindowControlsOverlay interface, which exposes
information about the title bar geometry in desktop Progressive Web Apps that use the Window Controls Overlay API.

[Value("windowControlsOverlay")]
public WindowControlsOverlay WindowControlsOverlay { get; }

Property Value

WindowControlsOverlay

The WindowControlsOverlay interface.

Remarks

Progressive Web Apps installed on desktop Operating Systems can opt-in to the
Window Controls Overlay feature by using the window-controls-overlay value in the
display_override web app manifest member.

Doing so hides the default window title bar and gives the app access to the full area
of the app window.

See also on MDN

Xr

NOTE
Experimental
The read-only xr property
provided by the Navigator interface returns an XRSystem object
which can be used to access the WebXR Device API.
[Value("xr")]
public XRSystem Xr { get; }

Property Value

XRSystem

The XRSystem object used to interface with the WebXR Device API in the current
context. This can be used to present augmented and/or virtual reality imagery to the
user.

Remarks

-WebGL API: 2D and 3D accelerated
graphics for the web
-Canvas API: 2D graphics API

See also on MDN

Methods

AdAuctionComponents(ushort)

[Value("adAuctionComponents")]
public List<string> AdAuctionComponents(ushort numAdComponents)

Parameters

numAdComponents ushort

Returns

List<string>

CanLoadAdAuctionFencedFrame()

[Value("canLoadAdAuctionFencedFrame")]
public bool CanLoadAdAuctionFencedFrame()

Returns

bool

CanShare(ShareData)

The canShare() method of the Navigator interface returns true if the equivalent call to Share(ShareData) would succeed.

[Value("canShare")]
public bool CanShare(ShareData data = null)

Parameters

data ShareData

Returns

bool

Returns true if the specified data can be shared with Share(ShareData), otherwise false.

Remarks

The method returns false if the data cannot be validated. Reasons the data might be invalid include:

The Web Share API is gated by the web-share permission policy.
The canShare() method will return false if the permission is supported but has not been granted.

-Share(ShareData)

See also on MDN

ClearOriginJoinedAdInterestGroups(string, List<string>)

[Value("clearOriginJoinedAdInterestGroups")]
public Task<GlobalObject.Undefined> ClearOriginJoinedAdInterestGroups(string owner, List<string> interestGroupsToKeep = null)

Parameters

owner string
interestGroupsToKeep List<string>

Returns

Task<GlobalObject.Undefined>

CreateAuctionNonce()

[Value("createAuctionNonce")]
public Task<string> CreateAuctionNonce()

Returns

Task<string>

CreateHandwritingRecognizer(HandwritingModelConstraint)

[Value("createHandwritingRecognizer")]
public Task<HandwritingRecognizer> CreateHandwritingRecognizer(HandwritingModelConstraint constraint)

Parameters

constraint HandwritingModelConstraint

Returns

Task<HandwritingRecognizer>

DeprecatedReplaceInURN(Union37, Dictionary<string, string>)

NOTE
Experimental
The deprecatedReplaceInURN() method of the Navigator interface substitutes specified strings inside the mapped URL corresponding to a given opaque URN or FencedFrameConfig&apos;s internal url property.
[Value("deprecatedReplaceInURN")]
public Task<GlobalObject.Undefined> DeprecatedReplaceInURN(Union37 urnOrConfig, Dictionary<string, string> replacements)

Parameters

urnOrConfig Union37
replacements Dictionary<string, string>

Returns

Task<GlobalObject.Undefined>

A Promise that fulfills with GlobalObject.Undefined.

Remarks

A FencedFrameConfig or opaque URN is returned from a source such as the Protected Audience API runAdAuction() method, and then set as the value of Config. The content URL associated with the FencedFrameConfig or opaque URN is mapped to it internally by the browser, and can&apos;t be accessed via JavaScript.

However, you may wish to substitute parts of that internal URL. This is a common approach for passing runtime data into ad creatives to use in rendering. deprecatedReplaceInURN() has been made available as a temporary measure to enable that substitution for fenced frame URLs, helping ad tech providers to migrate existing implementations across to privacy sandbox APIs.

-Fenced Frame API

See also on MDN

DeprecatedURNtoURL(Union37, bool)

[Value("deprecatedURNtoURL")]
public Task<string> DeprecatedURNtoURL(Union37 urnOrConfig, bool send_reports = false)

Parameters

urnOrConfig Union37
send_reports bool

Returns

Task<string>

GetAutoplayPolicy(AudioContext)

NOTE
Experimental
The getAutoplayPolicy() method of the Autoplay Policy Detection API provides information about whether autoplay of media elements and audio contexts is allowed, disallowed, or only allowed if the audio is muted.
[Value("getAutoplayPolicy")]
public AutoplayPolicy GetAutoplayPolicy(AudioContext context)

Parameters

context AudioContext

Returns

AutoplayPolicy

A string indicating the autoplay policy for the specified media feature type, element, or context.
This will be a string containing one of the following values:Note that the autoplay policy returned for a type parameter is the broad policy for items of the indicated type.
On page load, all items of a type will have the same policy as the type.
Once the user has interacted with the page/site, on some browsers individual items may have a different policy to the corresponding type.

Remarks

Applications can use this information to provide an appropriate user experience.
For example, if the user agent policy only allows autoplay of inaudible content, the application might mute videos so that they can still autoplay.

The method can be used to get either the broad autoplay policy for all items of a particular type in the document, or for specific media elements or audio contexts.

-Autoplay guide for media and Web Audio APIs

See also on MDN

GetAutoplayPolicy(AutoplayPolicyMediaType)

NOTE
Experimental
The getAutoplayPolicy() method of the Autoplay Policy Detection API provides information about whether autoplay of media elements and audio contexts is allowed, disallowed, or only allowed if the audio is muted.
[Value("getAutoplayPolicy")]
public AutoplayPolicy GetAutoplayPolicy(AutoplayPolicyMediaType type)

Parameters

type AutoplayPolicyMediaType

Returns

AutoplayPolicy

A string indicating the autoplay policy for the specified media feature type, element, or context.
This will be a string containing one of the following values:Note that the autoplay policy returned for a type parameter is the broad policy for items of the indicated type.
On page load, all items of a type will have the same policy as the type.
Once the user has interacted with the page/site, on some browsers individual items may have a different policy to the corresponding type.

Remarks

Applications can use this information to provide an appropriate user experience.
For example, if the user agent policy only allows autoplay of inaudible content, the application might mute videos so that they can still autoplay.

The method can be used to get either the broad autoplay policy for all items of a particular type in the document, or for specific media elements or audio contexts.

-Autoplay guide for media and Web Audio APIs

See also on MDN

GetAutoplayPolicy(HTMLMediaElement)

NOTE
Experimental
The getAutoplayPolicy() method of the Autoplay Policy Detection API provides information about whether autoplay of media elements and audio contexts is allowed, disallowed, or only allowed if the audio is muted.
[Value("getAutoplayPolicy")]
public AutoplayPolicy GetAutoplayPolicy(HTMLMediaElement element)

Parameters

element HTMLMediaElement

Returns

AutoplayPolicy

A string indicating the autoplay policy for the specified media feature type, element, or context.
This will be a string containing one of the following values:Note that the autoplay policy returned for a type parameter is the broad policy for items of the indicated type.
On page load, all items of a type will have the same policy as the type.
Once the user has interacted with the page/site, on some browsers individual items may have a different policy to the corresponding type.

Remarks

Applications can use this information to provide an appropriate user experience.
For example, if the user agent policy only allows autoplay of inaudible content, the application might mute videos so that they can still autoplay.

The method can be used to get either the broad autoplay policy for all items of a particular type in the document, or for specific media elements or audio contexts.

-Autoplay guide for media and Web Audio APIs

See also on MDN

GetBattery()

The getBattery() method provides information about the system&apos;s battery.
It returns a battery promise, which resolves with a BatteryManager object providing some properties to get the battery status also some events you can handle to monitor the battery status.
This implements the {{domxref(&quot;Battery Status API&quot;, &quot;&quot;, &quot;&quot;, &quot;nocode&quot;)}}; see that documentation for additional details, a guide to using the API, and sample code.

[Value("getBattery")]
public Task<BatteryManager> GetBattery()

Returns

Task<BatteryManager>

A {{JSxRef("Promise")}} that fulfills with a BatteryManager object which you can use to get information about the battery's state.

Remarks

Since Chrome 103, the Navigator.getBattery() method of {{domxref(&quot;Battery Status API&quot;, &quot;&quot;, &quot;&quot;, &quot;nocode&quot;)}} only expose to secure context.

NOTE

Access to this feature may be controlled by the Permissions-Policy directive Permissions-Policy/battery.

-{{domxref(&quot;Battery Status API&quot;, &quot;&quot;, &quot;&quot;, &quot;nocode&quot;)}}
-Permissions-Policy Permissions-Policy/battery directive

See also on MDN

GetGamepads()

The Navigator.getGamepads() method returns an array of
Gamepad objects, one for each gamepad connected to the device.

[Value("getGamepads")]
public List<Gamepad?> GetGamepads()

Returns

List<Gamepad>

An {{jsxref("Array")}} of Gamepad objects, eventually empty.

Remarks

Elements in the array may be null if a gamepad disconnects during a
session, so that the remaining gamepads retain the same index.

-Using the Gamepad API
-Gamepad API

See also on MDN

GetInstalledRelatedApps()

NOTE
Experimental
The getInstalledRelatedApps() method returns a promise that resolves with an array of objects representing any related platform-specific apps or Progressive Web Apps that the user has installed. This could be used for content personalization such as removing &quot;install our app&quot; banners from the web app if the platform-specific app and/or PWA is already installed.
[Value("getInstalledRelatedApps")]
public Task<List<RelatedApplication>> GetInstalledRelatedApps()

Returns

Task<List<RelatedApplication>>

A Promise that fulfills with an array of objects representing any installed related apps. Each object can contain the following properties:The related app information must have been previously specified in the related_applications member of the invoking web app&apos;s manifest file.

Remarks

NOTE

This method must be invoked in a top-level secure context, that is, not embedded in an iframe.

-Is your app installed? getInstalledRelatedApps() will tell you!

See also on MDN

GetInterestGroupAdAuctionData(AdAuctionDataConfig)

[Value("getInterestGroupAdAuctionData")]
public Task<AdAuctionData> GetInterestGroupAdAuctionData(AdAuctionDataConfig config)

Parameters

config AdAuctionDataConfig

Returns

Task<AdAuctionData>

JoinAdInterestGroup(AuctionAdInterestGroup)

[Value("joinAdInterestGroup")]
public Task<GlobalObject.Undefined> JoinAdInterestGroup(AuctionAdInterestGroup group)

Parameters

group AuctionAdInterestGroup

Returns

Task<GlobalObject.Undefined>

LeaveAdInterestGroup(AuctionAdInterestGroupKey)

[Value("leaveAdInterestGroup")]
public Task<GlobalObject.Undefined> LeaveAdInterestGroup(AuctionAdInterestGroupKey group = null)

Parameters

group AuctionAdInterestGroupKey

Returns

Task<GlobalObject.Undefined>

QueryHandwritingRecognizer(HandwritingModelConstraint)

[Value("queryHandwritingRecognizer")]
public Task<HandwritingRecognizerQueryResult?> QueryHandwritingRecognizer(HandwritingModelConstraint constraint)

Parameters

constraint HandwritingModelConstraint

Returns

Task<HandwritingRecognizerQueryResult>

RequestMIDIAccess(MIDIOptions)

The requestMIDIAccess() method of the 'Navigator' interface returns a {{jsxref('Promise')}} representing a request for access to MIDI devices on a user's system.
This method is part of the Web MIDI API, which provides a means for accessing, enumerating, and manipulating MIDI devices.

[Value("requestMIDIAccess")]
public Task<MIDIAccess> RequestMIDIAccess(MIDIOptions options = null)

Parameters

options MIDIOptions

Returns

Task<MIDIAccess>

A 'Promise' that resolves with a MIDIAccess object.

Remarks

This method may prompt the user for access to MIDI devices available to their system, or it may use a previously established preference to grant or deny access.
If permission is granted then the 'Promise' resolves and a MIDIAccess object is returned.

-Web MIDI API
-Introduction to Web MIDI

See also on MDN

RequestMediaKeySystemAccess(string, List<MediaKeySystemConfiguration>)

The requestMediaKeySystemAccess() method of the Navigator interface returns a {{jsxref('Promise')}} which delivers a 'MediaKeySystemAccess' object that can be used to access a particular media key system, which can in turn be used to create keys for decrypting a media stream.

[Value("requestMediaKeySystemAccess")]
public Task<MediaKeySystemAccess> RequestMediaKeySystemAccess(string keySystem, List<MediaKeySystemConfiguration> supportedConfigurations)

Parameters

keySystem string
supportedConfigurations List<MediaKeySystemConfiguration>

Returns

Task<MediaKeySystemAccess>

A {{jsxref('Promise')}} that fulfils with a 'MediaKeySystemAccess' object representing the media key system configuration described by keySystem and supportedConfigurations.

Remarks

This method is part of the Encrypted Media Extensions API, which brings support for encrypted media and DRM-protected video to the web.

This method may have user-visible effects such as asking for permission to access one or more system resources.
Consider that when deciding when to call requestMediaKeySystemAccess(); you don&apos;t want those requests to happen at inconvenient times.
As a general rule, this function should be called only when it's about time to create and use a MediaKeys object by calling the returned MediaKeySystemAccess object's CreateMediaKeys() method.

-Encrypted Media Extensions API
-Media Capture and Streams API
-WebRTC API
-DecodingInfo(MediaDecodingConfiguration)

See also on MDN

RunAdAuction(AuctionAdConfig)

[Value("runAdAuction")]
public Task<string?> RunAdAuction(AuctionAdConfig config)

Parameters

config AuctionAdConfig

Returns

Task<string>

SendBeacon(string, Union41?)

The navigator.sendBeacon()
method Asynchronous sends an HTTP POST request containing a small amount of data to a web server.

[Value("sendBeacon")]
public bool SendBeacon(string url, Union41? data = null)

Parameters

url string
data Union41?

Returns

bool

The sendBeacon() method returns true if the
user agent successfully queued the data for transfer.
Otherwise, it returns false.

Remarks

It&apos;s intended to be used for
sending analytics data to a web server, and avoids some of the problems with
legacy techniques for sending analytics, such as the use of
XMLHttpRequest.

NOTE

For use cases that need the ability to send requests with methods other than POST, or to change any request properties, or that need access to the server response, instead use the fetch() method with keepalive set to true.

-The visibilitychange event.
-{{domxref(&quot;Beacon_API&quot;,&quot;Beacon API&quot;, &quot;&quot;, &quot;true&quot;)}} overview page.
-Don&apos;t lose user and app state, use Page Visibility explains in
detail why you should use visibilitychange, not
beforeunload/unload.
-Page Lifecycle API gives best-practices guidance on handling
page lifecycle behavior in your web applications.
-PageLifecycle.js: a JavaScript library that deals with cross-browser inconsistencies in page lifecycle behavior.
-Back/forward cache explains what the back/forward cache is, and its implications for various page lifecycle events.

See also on MDN

Share(ShareData)

The share() method of the Navigator interface invokes the native sharing mechanism of the device to share data such as text, URLs, or files. The available share targets depend on the device, but might include the clipboard, contacts and email applications, websites, Bluetooth, etc.

[Value("share")]
public Task<GlobalObject.Undefined> Share(ShareData data = null)

Parameters

data ShareData

Returns

Task<GlobalObject.Undefined>

A Promise that resolves with undefined, or rejected with one of the Exceptions given below.

Remarks

The method resolves a Promise with undefined.
On Windows this happens when the share popup is launched, while on Android the promise resolves once the data has successfully been passed to the share target.

The Web Share API is gated by the web-share permission policy.
The share() method will throw exceptions if the permission is supported but has not been granted.

-CanShare(ShareData)
-https://wpt.live/web-share/ (web platform tests)

See also on MDN

UpdateAdInterestGroups()

[Value("updateAdInterestGroups")]
public GlobalObject.Undefined UpdateAdInterestGroups()

Returns

GlobalObject.Undefined

Vibrate(Union159)

The vibrate() method of the Navigator interface pulses the vibration
hardware on the device, if such hardware exists. If the device doesn&apos;t support
vibration, this method has no effect. If a vibration pattern is already in progress when
this method is called, the previous pattern is halted and the new one begins instead.

[Value("vibrate")]
public bool Vibrate(Union159 pattern)

Parameters

pattern Union159

Returns

bool

A boolean.

Remarks

If the method was unable to vibrate because of invalid parameters, it will return
false, else it returns true. If the pattern leads to a too
long vibration, it is truncated: the max length depends on the implementation.

Some devices may not vibrate if they are in Silent mode or Do Not Disturb (DND) mode. To ensure vibration works, make sure these modes are turned off and that vibration is enabled in the system settings.

-Vibration API

See also on MDN