Pointer Lock
Hides and captures the mouse for games and 3D views.
In one line
Can hide your mouse pointer and capture its movement for games or 3D views
Hides and captures the mouse for games and 3D views.
Gives raw relative mouse movement with unlimited range while the cursor is hidden. With unadjustedMovement the site gets unaccelerated input, a small hardware hint.
What it can and can't do
What the user does: You click inside a game or 3D view
It can
- Hide the pointer and track raw mouse movement
- Let you turn a camera or view without hitting the screen edge
- Use unaccelerated mouse input if the site asks for it
It cannot
- Start without a click, tap or key press
- Trap you; Esc always gets you out
- Keep control after you switch tabs or apps
- Work in Safari on iPhone
How it differs between platforms: Chrome, Firefox, Safari on Mac and Android browsers support it. Safari on iPhone does not.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 37 | 2014-08-26 | None |
| Edge | Supported | 13 | 2015-11-12 | None |
| Firefox | Supported | 50 | 2016-11-15 | None |
| Safari | Supported | 10.1 | 2017-03-27 | None |
| Safari on iPhone | Not supported | No mouse on iOS | Not listed | None |
| Chrome on Android | Supported | 144 | 2026-01-13 | None |
| Samsung Internet | Supported | 3.0 | 2015-04-10 | None |
How a site asks for it
| API | element.requestPointerLock({unadjustedMovement: true}); movementX, movementY |
| Browser compat keys | api.Element.requestPointerLock |
| How access is granted | gesture |
| What the user sees | Browser shows an on-screen notice and Esc to exit; some platforms prompt on re-lock. Needs a gesture. |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | Yes |
| How long it lasts | Until Esc or unlock |
| How to take it back | Press Escape, leave page |
| Inside an iframe | Frame needs allow-pointer-lock in sandbox |
Typical flow
- Click on an element
- requestPointerLock()
- Browser shows exit hint
- mousemove events carry movementX/Y
Data you get
What comes back: Relative mouse deltas
Shape: event
How often: per mouse event (about 125 Hz or higher)
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
movementX/Y | float | pixels | unbounded | 1 or fractional |
Technical limits
- Needs a gesture
- Escape always exits
The story
What it is
A page hides your mouse pointer and reads your raw movement, like in a shooter game.
For you
You click on a game and your mouse pointer disappears. You can turn endlessly with no screen edge stopping you. The browser shows a small note and Escape gives the pointer back.
For makers
First person games, 3D viewers and cloud gaming need unlimited relative mouse movement. Makers can offer console quality aim on the web without installing anything.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser shooter hides the pointer and uses raw mouse movement so you can spin the camera freely. | Krunker.io, Shell Shockers, Minecraft Classic |
| games | A cloud gaming service passes your raw mouse movement to the remote PC so aim feels right. | GeForce NOW, Xbox Cloud Gaming |
| creative | A 3D modeling web app locks the pointer while you orbit around an object. | Sketchfab |
| maps | A 3D globe or map site lets you drag without leaving the screen edge. | Google Earth |
| enterprise | A remote desktop in the browser shows the host's pointer rather than yours. | None named |
| analytics | Raw mouse deltas let a game study aim patterns, which also reveals cheaters. | None named |
Risks
- Can hide the cursor
- Fake click traps
What the platform says
- MDN (standards docs): Pointer Lock API. Describes a way for apps to capture the mouse and read how far it moves, used for games, 3D views and maps.
Good uses and abuse
Legitimate uses
- 3D games and CAD
Known abuse
- Locking cursor to a scam page
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 4 of 5 | How useful it is to honest apps |
| Friction | 1 of 5 | How much the user has to do |
| Fingerprint bits | 1 | Rough identifying entropy, when known |
History
- 2020-08, Chrome 88: unadjustedMovement option ships
Related capabilities
Related
- Keyboard Lock. Can capture keys like Escape and Alt+Tab while the page is full screen
Sources
How well checked: Based on official documentation.