Element.requestPointerLock()

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

instanceOfElement.requestPointerLock();

Specifications

Specification Status Comment
Pointer Lock
The definition of 'requestPointerLock()' in that specification.
Candidate Recommendation

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
requestPointerLockChrome Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge Full support 13Firefox Full support 50
Full support 50
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: moz
IE ? Opera Full support YesSafari Full support 10WebView Android Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Chrome Android Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Firefox Android Full support YesOpera Android Full support YesSafari iOS ? Samsung Internet Android Full support Yes
Full support Yes
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit

Legend

Full support
Full support
Compatibility unknown
Compatibility unknown
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also