UserActivation: hasBeenActive 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 hasBeenActive property of the UserActivation interface indicates whether the current window has sticky user activation.

Value

A boolean.

Examples

Checking if a user gesture was ever performed

Use the hasBeenActive property to check whether the user has interacted with the page since it was loaded.

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

Specifications

Specification
HTML Standard
# dom-useractivation-hasbeenactive

Browser compatibility

BCD tables only load in the browser

See also