dom / latest / element / requestpointerlock.html /

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()

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
From version 92, returns a promise instead of undefined. The behavior reflects a proposed specification change.
22-38
13
From version 92, returns a promise instead of undefined. The behavior reflects a proposed specification change.
50
14-50
No
24
From version 78, returns a promise instead of undefined. The behavior reflects a proposed specification change.
15-25
10.1
37
From version 92, returns a promise instead of undefined. The behavior reflects a proposed specification change.
≤37-38
37
From version 92, returns a promise instead of undefined. The behavior reflects a proposed specification change.
25-38
50
14-50
24
From version 65, returns a promise instead of undefined. The behavior reflects a proposed specification change.
14-25
No
3.0
From version 16, returns a promise instead of undefined. The behavior reflects a proposed specification change.
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