UserActivation: hasBeenActive property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since November 2023.

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
# dom-useractivation-hasbeenactive

Browser compatibility

See also