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 | Status |
|---|---|
| Pointer Lock | Candidate Recommendation |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
pointerlockchange event | Chrome
Full support
45
| Edge Full support ≤79 | Firefox ? | IE ? | Opera ? | Safari ? | WebView Android
Full support
45
| Chrome Android
Full support
45
| Firefox Android ? | Opera Android ? | Safari iOS ? | Samsung Internet Android
Full support
5.0
|
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
- Requires a vendor prefix or different name for use.
- Requires a vendor prefix or different name for use.
