Element.requestPointerLock()

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The Element.requestPointerLock() method lets you asynchronously ask for the pointer to be locked on the given element.

To track the success or failure of the request, it is necessary to listen for the pointerlockchange and pointerlockerror events at the Document level.

Syntax

requestPointerLock()

Parameters

None.

Return value

None (undefined).

Specifications

Specification
Pointer Lock 2.0
# dom-element-requestpointerlock

Browser compatibility

BCD tables only load in the browser

See also