Document:exitPointerLock() 方法

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Document 接口的 exitPointerLock() 方法异步释放先前通过 Element.requestPointerLock 请求的指针锁定。

备注: 在文档上调用 exitPointerLock() 方法,在元素上调用 requestPointerLock() 方法。

要跟踪请求的成功或失败,需要监听 pointerlockchange 事件和 pointerlockerror 事件。

语法

js
exitPointerLock()

参数

无。

返回值

无(undefined)。

规范

Specification
Pointer Lock 2.0
# dom-document-exitpointerlock

浏览器兼容性

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
exitPointerLock

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.

参见