MDN Web Docs

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

See also

Help improve MDN

Yes No

Learn how to contribute

This page was last modified on by MDN contributors.

Read the original on developer.mozilla.org ↗