e01.org

UserActivation: hasBeenActive property

HTML DOM

HTML DOM

The read-only **`hasBeenActive`** property of the UserActivation interface indicates whether the current window has sticky user activation.

## Value

A boolean.

## Examples

### Checking if a user gesture was ever performed

Use the `hasBeenActive` property to check whether the user has interacted with the page since it was loaded.

```js
if (navigator.userActivation.hasBeenActive) {
// proceed with auto-playing an animation, for example
}
```

## Specifications

## Browser compatibility

## See also

- UserActivation
- UserActivation.isActive
- [Features gated by user activation](/docs/Web/Security/Defenses/User_activation)

source: MDN Web Docs mirror · page

Cite this

"UserActivation: hasBeenActive property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/UserActivation/hasBeenActive

JSON record · API collection · citation policy