This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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.
var unlocked = window.screen.unlockOrientation();
Returns true if the orientation was successfully unlocked or false if the orientation couldn't be unlocked.
var unlockOrientation = screen.unlockOrientation || screen.mozUnlockOrientation || screen.msUnlockOrientation || (screen.orientation && screen.orientation.unlock);
if (unlockOrientation()) {
// orientation was unlocked
} else {
// orientation unlock failed
}
| Specification | Status | Comment |
|---|---|---|
| Screen Orientation API The definition of 'Screen Orientation' in that specification. | Working Draft | Draft specification |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 38 | ? | Yes
|
11
|
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
|
Yes | No | Yes |
© 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