UserActivation.hasBeenActive

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The read-only hasBeenActive property of the UserActivation interface indicates whether the current window has sticky user activation (see sticky activation).

Value

A boolean.

Examples

Checking if a user gesture was ever performed

Use the hasBeenActive property to check wether the user has ever interacted with the page.

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