Navigator: userActivation property
Baseline 2023Newly available
Since November 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Please help us by answering a few questions.
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 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
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
userActivation |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.