UserActivation:hasBeenActive 属性
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
接口的 hasBeenActive
只读属性表示当前的窗口是否有粘性用户激活。
值
一个布尔值。
示例
检查是否执行过用户手势
使用 hasBeenActive
属性检查用户自加载页面以来是否与页面进行过交互。
js
if (navigator.userActivation.hasBeenActive) {
// 例如,继续自动播放动画
}
规范
Specification |
---|
HTML # dom-useractivation-hasbeenactive |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
hasBeenActive |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full 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.