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

instanceOfElement.requestPointerLock();

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
requestPointerLock
37
22-38
13
50
14-50
No
24
15-25
10.1
37
≤37-38
37
25-38
50
14-50
24
14-25
No
3.0
1.5-3.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Element/requestPointerLock