This feature is not Baseline because it does not work in some of the most widely-used browsers.
The unlock() method of the ScreenOrientation interface unlocks the orientation of the containing document from its default orientation.
unlock()
None.
None (undefined).
The promise may be rejected with the following exceptions:
InvalidStateError DOMException
Thrown if the document is not fully active.
SecurityError DOMException
Thrown if the document's visibility state is hidden or if the document is forbidden to use the feature (for example, by omitting the keyword allow-orientation-lock of the sandbox attribute of the iframe element).
AbortError DOMException
Thrown if there is any other lock() method invoking.
| Specification |
|---|
| Screen Orientation> # dom-screenorientation-unlock> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
unlock |
38Always throwsNotSupportedError. |
79Always throwsNotSupportedError. |
43Always throwsNotSupportedError. |
25Always throwsNotSupportedError. |
No | 38 |
79–97The API exists but returnsNS_ERROR_UNEXPECTED. |
25 | No | 3.0 | 38 | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/unlock