JavaScript Navigator userActivation Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

navigator.userActivation is a read-only property that returns a UserActivation object for this window — so you can tell whether the user is interacting now, or has interacted at least once since load (MDN).

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use navigator.userActivation. Start with this line.

JavaScript
navigator.userActivation
CallWhat it does
navigator.userActivationPrimary signature.

Built into the browser. Read navigator.userActivation on Navigator — no import required.

Library declarations
JavaScript
navigator.userActivation

Parameters

This member has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*UserActivation

JavaScript Examples

Example 1 — Read Both Flags

Feature-detect and print transient vs sticky state.

JavaScript
if (!navigator.userActivation) {
  console.log("userActivation unavailable");
} else {
  console.log("isActive:", navigator.userActivation.isActive);
  console.log("hasBeenActive:", navigator.userActivation.hasBeenActive);
}
Try It Yourself

How It Works

  1. Detect. Older environments may not expose the property.
  2. Read isActive. Transient activation for the current gesture window.
  3. Read hasBeenActive. Sticky flag for any prior interaction since load.
  4. Timing matters. Running this on cold load often prints two false values.

Example 2 — Gate Work on isActive

MDN pattern: proceed only while transient activation is true.

JavaScript
document.getElementById("btn").addEventListener("click", () => {
  if (!navigator.userActivation) {
    console.log("userActivation unavailable");
    return;
  }
  if (navigator.userActivation.isActive) {
    console.log("Transient activation — safe to call gated APIs");
  } else {
    console.log("No transient activation");
  }
});
Try It Yourself

How It Works

  1. Listen for a click. The handler runs inside a user gesture.
  2. Check isActive. Should be true during that gesture window.
  3. Call gated APIs here. Share, clipboard write, vibrate, and similar often require this.
  4. Do not wait. Transient activation expires — call APIs immediately in the handler.

Example 3 — Sticky Activation with hasBeenActive

MDN pattern: unlock softer behavior after any prior interaction.

JavaScript
function maybeStartDemo() {
  if (!navigator.userActivation) {
    console.log("userActivation unavailable");
    return;
  }
  if (navigator.userActivation.hasBeenActive) {
    console.log("Sticky activation — user has interacted");
  } else {
    console.log("Waiting for first interaction…");
  }
}

document.addEventListener("click", maybeStartDemo);
maybeStartDemo();
Try It Yourself

How It Works

  1. Check on load. Before any click, hasBeenActive is usually false.
  2. Listen for interaction. Re-check after a click/tap.
  3. Sticky stays on. Once true, it remains true until the page reloads.
  4. Use case. Good for “start animation after first engagement,” not for one-shot gated APIs.

Browser Support

Navigator.userActivation returns a UserActivation object. MDN marks it Baseline Widely available (since November 2023). Window context only — not in workers.

✓ Baseline Widely available

Navigator.userActivation

Supported in modern Chrome, Firefox, Safari, Edge, and Opera. Use isActive for transient activation and hasBeenActive for sticky activation.

Baseline Widely available
Google Chrome All modern versions
Yes
Microsoft Edge All modern versions
Yes
Mozilla Firefox All modern versions
Yes
Apple Safari All modern versions
Yes
Opera All modern versions
Yes
Internet Explorer Not supported
No
userActivation Excellent in modern browsers

Bottom line: Safe for modern sites. See the MDN userActivation reference. Always feature-detect before reading flags.

Frequently Asked Questions

It is a read-only Navigator property that returns a UserActivation object with information about the current window’s user activation state — whether the user is interacting now, or has interacted since page load.
No. MDN marks it Baseline Widely available (since November 2023). It is not Deprecated, Experimental, or Non-standard.
UserActivation.isActive is true during transient activation — roughly while the user is currently interacting with the page (for example shortly after a click).
UserActivation.hasBeenActive is true for sticky activation — the user has completed at least one interaction since the page loaded.
Many powerful APIs (autoplay, clipboard write, device pickers, fullscreen, and similar) are gated behind a user gesture so sites cannot surprise users without interaction.
No. MDN notes UserActivation is only available in the window context and is not exposed to workers.

Next: userAgent

Learn how navigator.userAgent identifies the browser string (and when not to parse it).

userAgent tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

13 people found this page helpful