In JavaScript, the Document pointerlockerror event fires when locking the pointer failed — for technical reasons or because permission was denied (MDN). It is not cancelable and does not bubble.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Syntax
Listen for pointerlockerror. Start with this line.
JavaScript
addEventListener("pointerlockerror", fn)
Call
What it does
addEventListener("pointerlockerror", fn)
Primary signature.
Built into the browser. Listen with document.addEventListener("pointerlockerror", …) — no import required.
Library declarations
JavaScript
addEventListener("pointerlockerror", fn)
Parameters
Parameter
Description
Listener on document
Required. Event does not bubble (MDN)
Promise catch (if returned)
Optional. Some engines return a Promise from requestPointerLock()
Return Value
Return Value
Description
*
Fires as a Document event (listener receives the Event object).
JavaScript Examples
Example 1 — Listen on document
MDN style: handle lock failures with a Document listener.
Probe the property."pointerLockElement" in document is a quick signal.
Check the method. Confirm requestPointerLock exists.
Gate the UI. Only show the control when both checks pass.
Still listen for errors. Even “supported” requests can fail at runtime.
Compatibility
Browser Support
Documentpointerlockerror is part of the Pointer Lock API. MDN marks it Limited availability (not Baseline). It is not Deprecated, Experimental, or Non-standard — still feature-detect in production.
✓ Limited availability · Not Baseline
Document pointerlockerror
Fires when locking the pointer failed. Listen on document — the event does not bubble.
LimitedFeature-detect required
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
pointerlockerrorLimited
Bottom line: Support mirrors Pointer Lock. Always feature-detect, require a user gesture, and pair with pointerlockchange for the success path.
Frequently Asked Questions
It fires when locking the pointer failed — for technical reasons or because permission was denied (MDN). Listen on document; the event does not bubble.
No. MDN does not mark Document pointerlockerror as Deprecated, Experimental, or Non-standard. It has Limited availability (not Baseline), so feature-detect and test the browsers you care about.
Common reasons: no user gesture, unsupported browser or context, permission denial, or other technical restrictions. Listen for pointerlockerror and optionally handle a Promise rejection when requestPointerLock returns a Promise.
No. MDN states this event is not cancelable and does not bubble. Listen on document.
No. Unlike fullscreenerror (Element then Document), MDN documents pointerlockerror as a Document event that does not bubble.
Success path: pointerlockchange fires and pointerLockElement is non-null. Failure path: pointerlockerror fires instead and the pointer stays unlocked.