UserActivation.hasBeenActive

Baseline 2023
Newly available

Since November 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

UserActivation インターフェイスの読み取り専用プロパティ hasBeenActive は、現在のウインドウでユーザーによる粘着的な有効化がされているかを表します。(粘着的な有効化を参照してください)

boolean です。

これまでにユーザーによる操作が行われたかをチェックする

ユーザーがこれまでにページを操作したかをチェックするために hasBeenActive を使用します。

js
if (navigator.userActivation.hasBeenActive) {
  // 例えば、アニメーションの自動再生に進む
}

仕様書

Specification
HTML
# dom-useractivation-hasbeenactive

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
hasBeenActive

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報