Skip to Content
Platform.Ontology

AbsoluteOrientationSensor and RelativeOrientationSensor

Fused device orientation as a quaternion or rotation matrix.

Asks you firstLocation and motionGeneric Sensor APIWeb browsersWhile you use it

In one line

Can find which way your device is facing and tilted in 3D

Fused device orientation as a quaternion or rotation matrix.

Gives exact device attitude relative to Earth (absolute) or to its start pose (relative). Same privacy class as DeviceOrientation but easier to use for 3D scenes.

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

  • Find the device's tilt and facing, compared with the Earth or with where it started
  • Move a 3D scene, map or AR view as you turn the phone
  • Give smoother results than basic tilt events

It cannot

  • Run in Firefox or Safari, which do not support it
  • Show a prompt in Chrome; there is none by default
  • Know where you are on the map from it
  • Measure orientation while the page is closed

How it differs between platforms: Chrome, Edge and Samsung Internet support it. Safari and Firefox do not.

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported672018-05-29None
EdgeSupported792020-01-15None
FirefoxNot supportedNot availableNot listedNone
SafariNot supportedNot availableNot listedNone
Safari on iPhoneNot supportedNot availableNot listedNone
Chrome on AndroidSupported672018-05-31None
Samsung InternetSupported9.02018-09-15None

How a site asks for it

APInew AbsoluteOrientationSensor({frequency}); new RelativeOrientationSensor(); quaternion; populateMatrix()
Permission nameaccelerometer, gyroscope, magnetometer (absolute); accelerometer, gyroscope (relative)
Permissions policyaccelerometer
Browser compat keysapi.AbsoluteOrientationSensor
api.RelativeOrientationSensor
api.OrientationSensor
How access is grantedprompt
What the user seesChromium 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 gestureNo
How long it lastsSite setting Allow or Block per origin
How to take it backchrome://settings/content/sensors; Permissions API 'change' event
Inside an iframeCross-origin iframes blocked unless allow="accelerometer"; page must be focused and visible

Typical flow

  1. Check isSecureContext and Permissions Policy
  2. Construct the sensor with {frequency: 60}
  3. sensor.start()
  4. '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)

FieldTypeUnitRangePrecision
quaternionlist of 4 floatsunit quaternion-1 to 1float32
frequencyfloatHz1 to 601 Hz

Technical limits

  • Absolute needs three sensor permissions, relative needs two
  • Needs focus and secure context

The story

What it is

The page gets your exact device angle, from sensors blended together.

For you

A 3D scene or map matches the way you hold your phone with no jitter. On many phones there is no prompt. It is the same data as tilt, just smoother.

For makers

Makers use it for smooth 3D, AR and camera control. It has the same privacy class as tilt and motion events, so it can be fingerprinted and can leak typing.

Where you see it

TypeExampleApps
gamesA browser 3D game or VR cardboard view turns the camera exactly with your head or phone.None named
ar-vrA web AR page keeps a 3D model locked to your room as you move.8th Wall, Model Viewer
mapsA map uses full orientation to show a street view pointing where you face.Google Street View
mediaA virtual tour or 360 video lets you look around by moving your phone.None named
analyticsA tracker records orientation as part of a motion profile.None named
securityA site checks for steady human hand motion to catch emulators.None named

Risks

  • Same leaks as tilt data
  • Fingerprint clue

What the platform says

Good uses and abuse

Legitimate uses

  • 3D model viewers
  • Panoramas

Known abuse

  • Same as DeviceOrientation

Scores

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

History

  • 2018-05, Chrome 67: Orientation sensors ship with the Generic Sensor API

Sources

How well checked: Based on official documentation.

On this page