Screen.unlockOrientation()


This is an experimental technology
Check the Browser compatibility table carefully before using this in production.


The Screen.unlockOrientation() method removes all the previous screen locks set by the page/app.

Note: This method only works for installed Web apps or for Web pages in full-screen mode.

Syntax

var unlocked = window.screen.unlockOrientation();

Return value

Returns true if the orientation was successfully unlocked or false if the orientation couldn't be unlocked.

Example

var unlockOrientation = screen.unlockOrientation || screen.mozUnlockOrientation || screen.msUnlockOrientation || (screen.orientation && screen.orientation.unlock);

if (unlockOrientation()) {
  // orientation was unlocked
} else {
  // orientation unlock failed
}

Specifications

Specification Status Comment
Screen Orientation API
The definition of 'Screen Orientation' in that specification.
Working Draft Draft specification

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support 38Edge ? Firefox Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: moz
IE Full support 11
Prefixed
Full support 11
Prefixed
Prefixed Implemented with the vendor prefix: ms
Opera Full support YesSafari No support NoWebView Android Full support 38Chrome Android Full support 38Edge Mobile ? Firefox Android Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: moz
Opera Android Full support YesSafari iOS No support NoSamsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also

Document Tags and Contributors

Last updated by: urty5656,