UserActivation:isActive 属性
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
接口的 isActive
只读属性表示当前的窗口是否有瞬态用户激活。
值
一个布尔值。
示例
检查最近是否执行过用户手势
使用 isActive
属性可以检查用户当前是否正在与页面交互。
js
if (navigator.userActivation.isActive) {
// 例如,继续请求播放媒体
}
规范
Specification |
---|
HTML # dom-useractivation-isactive |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
isActive |
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.