Gyroscope
Reads how fast the device is rotating around three axes.
In one line
Can feel how fast your device turns while the page is open
Reads how fast the device is rotating around three axes.
Shows how fast the device turns. Gyroscope noise has been used to eavesdrop on nearby speech (Gyrophone, 2014) and to fingerprint devices, which is why browsers cap the rate.
What it can and can't do
What the user does: Nothing in most browsers. Chrome allows it by default unless you changed Motion sensors in site settings
It can
- Measure turning speed on three axes
- Move a 3D view or game as you turn the phone
- Help recognise your device through small sensor quirks
It cannot
- Run in Firefox or Safari, which do not support it
- Run at full speed; browsers cap the rate to limit eavesdropping on speech
- Show a prompt in Chrome; there is none by default
- Measure turning while the page is closed
How it differs between platforms: Chrome, Edge and Samsung Internet support it. Safari and Firefox do not.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 67 | 2018-05-29 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Not supported | Not available | Not listed | None |
| Safari | Not supported | Not available | Not listed | None |
| Safari on iPhone | Not supported | Not available | Not listed | None |
| Chrome on Android | Supported | 67 | 2018-05-31 | None |
| Samsung Internet | Supported | 9.0 | 2018-09-15 | None |
How a site asks for it
| API | new Gyroscope({frequency}) |
| Permission name | gyroscope |
| Permissions policy | gyroscope |
| Browser compat keys | api.Gyroscope |
| How access is granted | prompt |
| What the user sees | Chromium shows no bubble: access follows the Motion sensors site setting (default Allow) plus the Permissions API name. Safari and Firefox do not ship the API. |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | Site setting Allow or Block per origin |
| How to take it back | chrome://settings/content/sensors; Permissions API 'change' event |
| Inside an iframe | Cross-origin iframes blocked unless allow="gyroscope"; page must be focused and visible |
Typical flow
- Check isSecureContext and Permissions Policy
- Construct the sensor with {frequency: 60}
- sensor.start()
- 'reading' events fire; 'error' event on NotAllowedError or NotReadableError
Data you get
What comes back: Sensor readings at the requested frequency
Shape: event
How often: up to 60 Hz (Chrome caps frequency)
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
x, y, z | float | radians per second | about -35 to 35 (hardware) | about 0.001 |
frequency | float | Hz | 1 to 60 (Chrome cap) | 1 Hz |
Technical limits
- 60 Hz cap mitigates the audio side channel
- No readings while hidden
The story
What it is
The page reads how fast your device is turning.
For you
You twist your phone and a game camera turns, or a 360 photo spins. On many phones there is no big prompt. The sensor can also pick up tiny sounds from nearby speech.
For makers
Makers use it for smooth camera control in 3D and AR. Trackers can use sensor quirks to recognize a phone, and research showed it can eavesdrop on speech nearby.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser first person game or 3D viewer turns the camera as you turn your phone. | Sketchfab |
| ar-vr | A web AR try on page uses turning speed to keep models fixed in place. | 8th Wall |
| media | A 360 degree video pans smoothly as you twist your phone. | YouTube 360 |
| maps | A web map turns as you turn, with smooth compass behavior. | None named |
| security | Researchers showed a page could pick up speech through gyroscope vibration, an eavesdropping risk. | None named |
| analytics | A fingerprinting script uses tiny gyro errors to recognize one phone among millions. | None named |
Risks
- Can eavesdrop on speech
- Fingerprints devices
What the platform says
- Google Chrome: Generic Sensor API. Chrome describes a common way for web pages to read motion and environment sensors such as accelerometer and gyroscope.
Good uses and abuse
Legitimate uses
- Camera stabilisation
- VR head tracking
Known abuse
- Device fingerprinting by sensor bias
- Speech eavesdropping at higher rates
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 3 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 1 of 5 | How much the user has to do |
| Fingerprint bits | 4 | Rough identifying entropy, when known |
History
- 2014-08, paper n/a: Gyrophone shows speech recovery from gyroscope sampled near 200 Hz
- 2018-05, Chrome 67: Gyroscope ships
Related capabilities
Related
- DeviceOrientation and DeviceMotion events. Can sense how your phone is tilted and shaken, sometimes only after you allow it
- AbsoluteOrientationSensor and RelativeOrientationSensor. Can find which way your device is facing and tilted in 3D
Sources
How well checked: Based on official documentation.