web api instance property
Navigator: userActivation property
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 isActive to check whether the user is currently interacting with the page (Transient activation).
if (navigator.userActivation.isActive) {
// proceed to request playing media, for example
}
Checking if a user gesture was ever performed
Use hasBeenActive to check whether the user has ever interacted with the page (Sticky activation).
if (navigator.userActivation.hasBeenActive) {
// proceed with auto-playing an animation, for example
}
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.