Screen orientation
Whether the screen is portrait or landscape and its rotation angle.
In one line
Can tell if your screen is upright or sideways, and by how many degrees
Whether the screen is portrait or landscape and its rotation angle.
Shows how a phone is held and whether a tablet is docked. Reports type (portrait-primary etc.) and angle 0, 90, 180 or 270; changes with a rotate event.
What it can and can't do
What the user does: Nothing. It happens when the page loads or you rotate the device.
It can
- Check portrait or landscape
- Check the rotation angle
- Notice when you rotate the device
- Change its layout to match
It cannot
- See the device's tilt or movement, which is a different sensor
- Rotate your screen for you
- Learn how you are holding the device when rotation is locked
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 38 | 2014-10-07 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Supported | 43 | 2015-12-15 | None |
| Safari | Supported | 16.4 | 2023-03-27 | None |
| Safari on iPhone | Supported | 16.4 | 2023-03-27 | None |
| Chrome on Android | Supported | 38 | 2014-10-08 | None |
| Samsung Internet | Supported | 3.0 | 2015-04-10 | None |
How a site asks for it
| API | screen.orientation.type, .angle; matchMedia('(orientation)') |
| Browser compat keys | api.ScreenOrientation.type |
| How access is granted | none |
| What the user sees | None |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | read fresh on every page load; nothing stored |
| How to take it back | none needed (no grant) |
| Inside an iframe | Readable from cross-origin iframes too (same values) |
Typical flow
- Page script reads the value
- No prompt is shown
Data you get
Shape: object
How often: static per session
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
type | enum | None | portrait-primary, portrait-secondary, landscape-primary, landscape-secondary | Not listed |
angle | integer | degrees | 0, 90, 180, 270 | Not listed |
Technical limits
- No tilt or accelerometer data
The story
What it is
Tells a page whether your screen is tall or wide, and how far it is turned.
For you
You turn your phone and the page rearranges itself. That change is the page reading the orientation and moving things around.
For makers
Makers use it to fit layouts to the screen shape. It also hints at the device type, since a laptop is always wide and a phone often tall.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser racing game switches to a wide track and moves the buttons to the sides when you turn the phone. | None named |
| video | A video site goes full screen when you turn your phone sideways. | YouTube, Netflix |
| shopping | A store shows a two column gallery in landscape and a single scroll in portrait. | None named |
| maps | A web map shows a side panel in landscape and a bottom sheet in portrait. | Google Maps |
| security | A fraud check notes that a supposed phone never changes orientation and reports a desktop size, a sign of a faked device. | None named |
| education | A reading app asks students to turn the device so long math tables fit. | None named |
| analytics | A team sees which orientation most visitors use before designing a new page. | None named |
Risks
- Mild fingerprint clue
- Hints at device type
What the platform says
- MDN: Screen Orientation API. Explains how a page can read whether the screen is portrait or landscape and react when it turns.
Good uses and abuse
Legitimate uses
- Layout
- Lock orientation in fullscreen
Known abuse
- Device use pattern
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 1 | Rough identifying entropy, when known |
A real example: LinkedIn
Orientation collected. Read by the LinkedIn APFC fingerprint script (alleged by BrowserGate, partly confirmed by BleepingComputer).
Sources
How well checked: Based on official documentation.