Document: pointerlockchange event

The pointerlockchange event is fired when the pointer is locked/unlocked.

Bubbles Yes
Cancelable No
Interface Event
Event handler property onpointerlockchange

Examples

Using addEventListener():

document.addEventListener('pointerlockchange', (event) => {
  console.log('Pointer lock changed');
});

Using the onpointerlockchange event handler property:

document.onpointerlockchange = (event) => {
  console.log('Pointer lock changed');
};

Specifications

Specification
Pointer Lock 2.0
# pointerlockchange-and-pointerlockerror-events

Browser compatibility

BCD tables only load in the browser

See also