screen.unlockOrientation() was a legacy helper that removed orientation locks set by the page/app. It returns true on success or false on failure (MDN). Prefer screen.orientation.unlock().
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call screen.unlockOrientation. Start with this line.
JavaScript
screen.unlockOrientation()
Call
What it does
screen.unlockOrientation()
Primary signature.
screen.unlockOrientation(...)
Call with the arguments your case needs.
Built into the browser. Call unlockOrientation(...) on a Screen — no import required.
Library declarations
JavaScript
screen.unlockOrientation()
Parameters
This member has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
true or false
JavaScript Examples
Example 1 — Feature-Detect
See which unlock path exists in this browser.
JavaScript
const modern = !!(screen.orientation && screen.orientation.unlock);
const legacy = !!(
screen.unlockOrientation ||
screen.mozUnlockOrientation ||
screen.msUnlockOrientation
);
console.log(modern ? "modern unlock()" : "no modern unlock");
console.log(legacy ? "legacy unlockOrientation" : "no legacy API");
Pick the first available name. Covers unprefixed and vendor prefixes.
Call with screen as this. Important when storing the function reference.
Read the boolean.true means unlocked; false means it could not unlock (MDN).
Do not ship this. Prefer screen.orientation.unlock() in new apps.
Compatibility
Browser Support
Screen.unlockOrientation() is Deprecated and Non-standard on MDN. It is not part of any specification. Prefer screen.orientation.unlock().
✓ Deprecated · Non-standard
Screen.unlockOrientation()
Legacy orientation unlock. Feature-detect only for literacy; ship ScreenOrientation.unlock() for new work.
LegacyDeprecated API
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
screen.unlockOrientation()Avoid
Bottom line: Literacy only. Use screen.orientation.unlock() and treat orientation lock as optional / permission-sensitive.
Frequently Asked Questions
MDN: Screen.unlockOrientation() removes all previous screen locks set by the page/app. Prefer ScreenOrientation.unlock() instead.
Yes. MDN marks Screen.unlockOrientation() as Deprecated and Non-standard. It is not part of any specification and is no longer on track to become a standard.
Use screen.orientation.unlock() from the Screen Orientation API (MDN). That is the modern path.
MDN: only for installed Web apps or for Web pages in fullscreen mode. Ordinary tabs usually could not unlock orientation.
true if the orientation was successfully unlocked, false if it could not be unlocked (MDN).
Vendors shipped prefixed names (mozUnlockOrientation, msUnlockOrientation). Legacy snippets often feature-detect across those names (MDN).