coderef

Pointer lockLimited availability

Provides access to raw mouse movement by locking the target of mouse events to a single element and hiding the mouse cursor.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–36Not supported
37+Supportedsince Aug 26, 2014
Current: 155
Edge
12–12Not supported
13+Supportedsince Nov 12, 2015
Current: 154
Firefox
1–49Not supported
50+Supportedsince Nov 15, 2016
Current: 157
Safari
1–10Not supported
10.1+Supportedsince Mar 27, 2017
Current: 27
MobileChrome Android
18–143Not supported
144+Supportedsince Jan 13, 2026
Current: 155
Firefox Android
4–49Not supported
50+Supportedsince Nov 15, 2016
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: exitPointerLock.

Feature detection

JS · check before using
if ("Document" in globalThis && "exitPointerLock" in Document.prototype) {
  // Document.exitPointerLock is available
}

Sub-features

Support for each part of the feature (5). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
Document.exitPointerLock37135010.114450✕
Document.pointerLockElement37135010.114450✕
Document.pointerlockchange_event36135010.114450✕
Document.pointerlockerror_event36135010.114450✕
Element.requestPointerLock37135010.114450✕