Skip to Content
Platform.Ontology

DeviceOrientation and DeviceMotion events

Tilt and shake data from the phone; iOS asks first, Android Chrome does not.

Asks you firstLocation and motionMotionWeb browsersWhile you use it

In one line

Can sense how your phone is tilted and shaken, sometimes only after you allow it

Tilt and shake data from the phone; iOS asks first, Android Chrome does not.

Reveals how the device is held and moved: tilt, walking cadence, vehicle vibration. Research has inferred PINs and keystrokes from tilt patterns, and it hints at device class.

What it can and can't do

What the user does: You open a tilt based page, like a game or AR view, and tap Allow on iPhone

It can

  • Measure tilt, turning and shaking while the page is open
  • Spot walking steps or vehicle bumps
  • Move a view or game as you tilt the phone

It cannot

  • Run without your Allow on iPhone Safari 13 and later
  • Measure motion while the page is closed or in the background
  • Be blocked by default on Android Chrome and Firefox; they allow it unless you turn Motion sensors off
  • Know your location; it only senses motion

How it differs between platforms: iPhone Safari asks first. Chrome and Firefox on Android allow it unless you block Motion sensors in site settings.

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported72010-10-19Secure context required from 50; no prompt
EdgeSupported122015-07-29None
FirefoxSupported62011-08-16No prompt
SafariSupported172023-09-18iOS 13 added requestPermission; macOS Safari has no motion sensors
Safari on iPhoneSupported4.22010-11-22All iOS browsers use WebKit
Chrome on AndroidSupported182012-06-27None
Samsung InternetSupported1.02013-04-27None

How a site asks for it

APIaddEventListener('deviceorientation'|'deviceorientationabsolute'|'devicemotion'); DeviceMotionEvent.requestPermission(), DeviceOrientationEvent.requestPermission()
Permission nameaccelerometer, gyroscope, magnetometer (Chromium)
Permissions policyaccelerometer; gyroscope; magnetometer
Browser compat keysapi.DeviceOrientationEvent
api.DeviceOrientationEvent.requestPermission
api.DeviceMotionEvent
api.DeviceMotionEvent.requestPermission
How access is grantedprompt
What the user seesiOS Safari 13+: system alert asking for Motion and Orientation access, Allow or Don't Allow, after requestPermission(). Chrome and Firefox on Android: no prompt, Motion sensors site setting defaults to Allow. Most desktops: events do not fire.
Needs a secure context (HTTPS)Yes
Needs a user gestureYes
How long it lastsiOS: remembered for the page session and re-asked after the page process ends; Chrome: site setting Allow or Block per origin
How to take it backiOS: Settings > Safari > Advanced > Motion & Orientation Access (iOS 12.2 global switch); Chrome: Site settings > Motion sensors
Inside an iframeCross-origin iframes blocked unless allow="accelerometer; gyroscope; magnetometer" (Chrome 76+)

Typical flow

  1. iOS: call requestPermission() inside a click handler
  2. Person taps Allow
  3. Promise resolves 'granted'
  4. Add listeners; events fire at about 60 Hz while the tab is visible

Data you get

What comes back: Orientation angles and motion vectors
Shape: event
How often: about 60 Hz maximum

FieldTypeUnitRangePrecision
alphafloat or nulldegrees0 to 360about 0.1 degree; absolute only on deviceorientationabsolute
betafloat or nulldegrees-180 to 180about 0.1 degree
gammafloat or nulldegrees-90 to 90about 0.1 degree
acceleration x/y/zfloat or nullm/s2 without gravityabout -20 to 20about 0.01
accelerationIncludingGravity x/y/zfloatm/s2about -20 to 20about 0.01
rotationRate alpha/beta/gammafloatdegrees per secondabout -2000 to 2000about 0.1
intervalfloatmsabout 16 at 60 Hz1 ms

Technical limits

  • iOS requires a user gesture to request
  • No events when the tab is hidden
  • Rate about 60 Hz
  • Mostly absent on desktops
  • Blocked in insecure contexts

The story

What it is

The page feels how you tilt and shake your phone.

For you

You tilt your phone and a 360 photo turns, a marble rolls or a compass needle moves. On iPhone a prompt asks first. On many Android browsers there is no prompt at all.

For makers

Tilt makes web games, AR and photo viewers feel alive without an app. It is also read by trackers, since small sensor quirks are a fingerprint, and research has shown typing can be guessed from motion.

Where you see it

TypeExampleApps
gamesA browser racing or balance game lets you steer by tilting your phone.None named
ar-vrA web AR try on or furniture placement page uses tilt to place a sofa in your room.IKEA Place web, 8th Wall
mapsA web map or compass turns the arrow as you turn your phone.Google Maps
mediaA 360 degree video or virtual tour pans as you move your phone.YouTube 360
fitnessA web workout counter uses shakes and steps to count reps or steps.None named
securityResearchers showed that a page can infer typed PINs from tilt, which is why iPhone asks first.None named
adsA fraud tool checks for believable motion, because a phone farm or emulator has none.None named

Risks

  • Can leak typing or PINs
  • Often no prompt on Android

What the platform says

Good uses and abuse

Legitimate uses

  • Tilt-controlled games
  • 360 video and panoramas
  • AR on the web
  • Shake to undo

Known abuse

  • PIN and keystroke inference from motion (published attacks)
  • Hardware fingerprinting from sensor calibration (SensorID, 2019)

Scores

ScoreValueMeaning
Sensitivity3 of 5How revealing the data is
Utility4 of 5How useful it is to honest apps
Friction1 of 5How much the user has to do
Fingerprint bits4Rough identifying entropy, when known

History

  • 2016-04, Chrome 50: Orientation and motion events restricted to secure contexts
  • 2019-03, Safari on iPhone 12.2: Motion and Orientation access disabled by default behind a setting
  • 2019-07, Chrome 76: Cross-origin iframes need accelerometer, gyroscope, magnetometer policy
  • 2019-09, Safari on iPhone 13: requestPermission() added; per-site prompt replaces the global setting

Sources

How well checked: Based on official documentation.

On this page