Document:pointerlockerror 事件
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
pointerlockerror
事件在锁定指针失败(由于技术原因或权限被拒绝)时触发。
此事件不可取消,也不会冒泡。
语法
在诸如 addEventListener()
之类的方法中使用事件名称,或设置事件处理器属性。
js
addEventListener("pointerlockerror", (event) => {});
onpointerlockerror = (event) => {};
事件类型
通用 Event
。
示例
使用 addEventListener()
:
js
const para = document.querySelector("p");
document.addEventListener("pointerlockerror", (event) => {
console.log("指针锁定错误");
});
使用 onpointerlockerror
事件处理器属性:
js
document.onpointerlockerror = (event) => {
console.log("指针锁定错误");
};
规范
Specification |
---|
Pointer Lock 2.0 # pointerlockchange-and-pointerlockerror-events |
Pointer Lock 2.0 # dom-document-onpointerlockerror |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
pointerlockerror event |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Requires a vendor prefix or different name for use.
- Has more compatibility info.
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.