coderef

Screen orientation lockLimited availability

The screen.orientation.lock() method prevents changes to the screen orientation, typically in fullscreen applications such as games. For example, while locked, rotating a phone to the side won't change the screen orientation from landscape to portrait.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
✕Not supportedup to 155
Current: 155
Edge
✕Not supportedup to 154
Current: 154
Firefox
1–143Not supported
144+Supportedsince Oct 14, 2025
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–37Not supported
38+Supportedsince Oct 8, 2014
Current: 155
Firefox Android
4–143Not supported
144+Supportedsince Oct 14, 2025
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Chrome, Edge, Safari, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: lock.

Feature detection

JS · check before using
if ("ScreenOrientation" in globalThis && "lock" in ScreenOrientation.prototype) {
  // ScreenOrientation.lock is available
}

Documentation (MDN)

Specification

Sub-features

Support for each part of the feature (2). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
ScreenOrientation.lock✕✕144✕38144✕
ScreenOrientation.unlock✕✕144✕38144✕