Navigator: userActivation プロパティ
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.
userActivation
は Navigator
インターフェイスの読み取り専用プロパティで、現在のウインドウのユーザーによる有効化の状態についての情報を持つ UserActivation
オブジェクトを返します。
値
UserActivation
オブジェクトです。
例
最近ユーザーによる操作が行われたかをチェックする
ユーザーが最近ページを操作したか (一時的な有効化) をチェックするために UserActivation.isActive
を使用します。
js
if (navigator.userActivation.isActive) {
// 例えば、メディアの再生の要求に進む
}
これまでにユーザーによる操作が行われたかをチェックする
ユーザーがこれまでにページを操作したか (粘着的な有効化) をチェックするために UserActivation.hasBeenActive
を使用します。
js
if (navigator.userActivation.hasBeenActive) {
// 例えば、アニメーションの自動再生に進む
}
仕様書
Specification |
---|
HTML # dom-navigator-useractivation |
ブラウザーの互換性
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.