跳转到主要内容

Document: exitPointerLock() method

{{APIRef("Pointer Lock API")}}

The exitPointerLock() method of the {{domxref("Document")}} interface asynchronously releases a pointer lock previously requested through {{domxref("Element.requestPointerLock")}}.

[!NOTE] While the exitPointerLock() method is called on the document, the requestPointerLock() method is called on an element.

To track the success or failure of the request, it is necessary to listen for the {{domxref("Document/pointerlockchange_event", "pointerlockchange")}} and {{domxref("Document/pointerlockerror_event", "pointerlockerror")}} events.

Syntax

exitPointerLock()

Parameters

None.

Return value

None ({{jsxref("undefined")}}).

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{ domxref("Document.pointerLockElement") }}
  • {{ domxref("Element.requestPointerLock()") }}
  • Pointer Lock