Device Access

Pointer Lock

Probing…

Pointer Lock is a web platform capability in the Device Access category. Unlimited relative mouse movement for games and 3D. Supported in Chromium 37+, Firefox 50+, and Safari 10.1+. Requires a user gesture such as a click or tap.

User gesture

Try it

Loading demo…

Code

box.addEventListener('click', () => box.requestPointerLock())

document.addEventListener('pointerlockchange', () => {
  const locked = document.pointerLockElement === box
  console.log('locked:', locked)
})

document.addEventListener('mousemove', (e) => {
  // Relative, unbounded motion — no clientX/clientY while locked
  console.log(e.movementX, e.movementY)
})

Browser support

Chromium
37
Firefox
50
Safari
10.1

Frequently asked questions

Which browsers support Pointer Lock?

Supported in Chromium 37+, Firefox 50+, and Safari 10.1+.

Does Pointer Lock require HTTPS?

No. Pointer Lock works without a secure context, though serving your site over HTTPS is always recommended.

What is Pointer Lock used for?

Unlimited relative mouse movement for games and 3D.

Can I try Pointer Lock in my browser?

Yes. shwcs.net runs a live Pointer Lock demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.

MDN reference ↗ Specification ↗