Screen Orientation lock
Forces the screen into portrait or landscape.
In one line
Can lock your screen to portrait or landscape, but only in full screen
Forces the screen into portrait or landscape.
Controls how the person holds the phone. It reads nothing, but it can trap a page in one orientation.
What it can and can't do
What the user does: You tap Full screen or open an installed web app, then start a game or video.
It can
- Lock the screen to portrait or landscape
- Unlock it again when you leave full screen
- Work in installed web apps on Android
It cannot
- Lock the screen unless the page is full screen or installed on Android
- Work in Safari, including on iPhone
- Stay locked after you leave the page
- Override your phone's own rotation lock in every case
How it differs between platforms: Android Chrome and Edge allow it in full screen. Safari and iPhone do not.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Partial | 38 | 2014-10-07 | Always throws <code>NotSupportedError</code>. |
| Edge | Partial | 79 | 2020-01-15 | Always throws <code>NotSupportedError</code>. |
| Firefox | Supported | 144 | 2025-10-14 | None |
| Safari | Not supported | Not available | Not listed | None |
| Safari on iPhone | Not supported | Not available | Not listed | 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.lock('landscape'), unlock(), screen.orientation.type |
| Browser compat keys | api.ScreenOrientation.lock |
| How access is granted | gesture |
| What the user sees | No prompt; page must be fullscreen on Chrome Android (or installed PWA) |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | Yes |
| How long it lasts | Per origin |
| How to take it back | Site settings |
| Inside an iframe | Same as top level; cross-origin iframes need a permissions policy where listed |
Typical flow
- Call the API
- Browser applies its access rules
- Page receives the result
Data you get
What comes back: Forces the screen into portrait or landscape.
Shape: object
How often: on demand
| 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
- Fullscreen or installed PWA required on Chrome
- No effect on desktop
- iOS Safari does not implement lock()
The story
What it is
A page can force your screen to stay in portrait or landscape.
For you
You go full screen in a game or video and the phone flips to landscape and stays there, even if you tilt it.
For makers
Makers use it for games and video where one way up is better. It reads nothing from you, but it can trap you in one view if misused.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser racing game locks to landscape so steering with tilt works. | None named |
| games | Cloud gaming on a phone browser forces landscape for the controls. | Xbox Cloud Gaming, GeForce NOW |
| video | A video player locks to landscape when you go full screen. | YouTube, Netflix |
| creative | A camera tool keeps a photo in the right direction. | None named |
| productivity | A web document scanner keeps pages upright. | None named |
| ads | A sneaky ad forces landscape to fill the screen. | None named |
Risks
- Trapped orientation
- Not on iPhone
What the platform says
- Mozilla: ScreenOrientation.lock(). MDN says the lock method locks the screen into a chosen orientation, usually in fullscreen.
Good uses and abuse
Legitimate uses
- Games
- Video players
- Camera tools
Known abuse
- Orientation trap
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 | 1 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2014, Chrome 38: lock() ships on Android, fullscreen only
- 2026, Firefox 144: Firefox ships lock()
Related capabilities
Related
- Vibration. Can buzz the phone in a pattern, after you have tapped on the page
Sources
How well checked: Checked against real behavior.