W3cubDocs

/DOM

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 compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 38 ? Yes
Prefixed
Yes
Prefixed
Prefixed Implemented with the vendor prefix: moz
11
Prefixed
11
Prefixed
Prefixed Implemented with the vendor prefix: ms
Yes No
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support 38 38 ? Yes
Prefixed
Yes
Prefixed
Prefixed Implemented with the vendor prefix: moz
Yes No Yes

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/screen/unlockOrientation