Navigator: userActivation property

Baseline 2023
Newly available

Since November 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

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

A UserActivation object.

Examples

Checking if a user gesture was recently performed

Use UserActivation.isActive to check whether the user is currently interacting with the page (Transient activation).

js
if (navigator.userActivation.isActive) {
  // proceed to request playing media, for example
}

Checking if a user gesture was ever performed

Use UserActivation.hasBeenActive to check whether the user has ever interacted with the page (Sticky activation).

js
if (navigator.userActivation.hasBeenActive) {
  // proceed with auto-playing an animation, for example
}

Specifications

Specification
HTML
# dom-navigator-useractivation

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Node.js
userActivation
Chrome – Full support
Chrome 72 (Release date: 2019-01-29)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 120 (Release date: 2023-11-21)
footnote Full support
Opera – Full support
Opera 60 (Release date: 2019-04-09)
footnote Full support
Safari – Full support
Safari 16.4 (Release date: 2023-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 72 (Release date: 2019-01-29)
footnote Full support
Firefox for Android – Full support
Firefox for Android 120 (Release date: 2023-11-21)
footnote Full support
Opera Android – Full support
Opera Android 51 (Release date: 2019-03-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
Samsung Internet – Full support
Samsung Internet 11 (Release date: 2019-12-05)
footnote Full support
WebView Android – Full support
WebView Android 72 (Release date: 2019-01-29)
footnote Full support
WebView on iOS – Full support
WebView on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
Node.js – No support
Node.js
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

See also