Back to Content

UserActivation: isActive property

files/en-us/web/api/useractivation/isactive/index.md

latest764 B
Original Source

{{APIRef("HTML DOM")}}

The read-only isActive property of the {{domxref("UserActivation")}} interface indicates whether the current window has {{Glossary("transient activation", "transient user activation")}}.

Value

A boolean.

Examples

Checking if a user gesture was recently performed

Use the isActive property to check whether the user is currently interacting with the page.

js
if (navigator.userActivation.isActive) {
  // proceed to request playing media, for example
}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also