Skip to Content
Platform.Ontology

Screen orientation

Whether the screen is portrait or landscape and its rotation angle.

Gets silentlyScreen and windowsScreenWeb browsersWhen the page loadsWhile you use it

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

BrowserStatusFirst versionReleasedNote
ChromeSupported382014-10-07None
EdgeSupported792020-01-15None
FirefoxSupported432015-12-15None
SafariSupported16.42023-03-27None
Safari on iPhoneSupported16.42023-03-27None
Chrome on AndroidSupported382014-10-08None
Samsung InternetSupported3.02015-04-10None

How a site asks for it

APIscreen.orientation.type, .angle; matchMedia('(orientation)')
Browser compat keysapi.ScreenOrientation.type
How access is grantednone
What the user seesNone
Needs a secure context (HTTPS)No
Needs a user gestureNo
How long it lastsread fresh on every page load; nothing stored
How to take it backnone needed (no grant)
Inside an iframeReadable from cross-origin iframes too (same values)

Typical flow

  1. Page script reads the value
  2. No prompt is shown

Data you get

Shape: object
How often: static per session

FieldTypeUnitRangePrecision
typeenumNoneportrait-primary, portrait-secondary, landscape-primary, landscape-secondaryNot listed
angleintegerdegrees0, 90, 180, 270Not 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

TypeExampleApps
gamesA browser racing game switches to a wide track and moves the buttons to the sides when you turn the phone.None named
videoA video site goes full screen when you turn your phone sideways.YouTube, Netflix
shoppingA store shows a two column gallery in landscape and a single scroll in portrait.None named
mapsA web map shows a side panel in landscape and a bottom sheet in portrait.Google Maps
securityA fraud check notes that a supposed phone never changes orientation and reports a desktop size, a sign of a faked device.None named
educationA reading app asks students to turn the device so long math tables fit.None named
analyticsA 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

Good uses and abuse

Legitimate uses

  • Layout
  • Lock orientation in fullscreen

Known abuse

  • Device use pattern

Scores

ScoreValueMeaning
Sensitivity1 of 5How revealing the data is
Utility3 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bits1Rough 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.

On this page