W3cubDocs

/Web APIs

Document: pointerlockerror event

The pointerlockerror event is fired when locking the pointer failed (for technical reasons or because the permission was denied).

This event is not cancelable.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

js

addEventListener("pointerlockerror", (event) => {});

onpointerlockerror = (event) => {};

Event type

A generic Event.

Examples

Using addEventListener():

js

const para = document.querySelector("p");

document.addEventListener("pointerlockerror", (event) => {
  console.log("Error locking pointer");
});

Using the onpointerlockerror event handler property:

js

document.onpointerlockerror = (event) => {
  console.log("Error locking pointer");
};

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
pointerlockerror_event 3622–38 13 5014–50 No 2315–25 10.1 374.4–38 3625–38 5014–50 2414–25 No 3.01.5–3.0

See also

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