ScreenOrientation.lock()
The lock()
property of the ScreenOrientation
interface locks the orientation of the containing document to its default orientation.
Syntax
screen.orientation.lock(orientation)
Parameters
- orientation
-
An orientation lock type. One of the following:
"any"
"natural"
"landscape"
"portrait"
"portrait-primary"
"portrait-secondary"
"landscape-primary"
"landscape-secondary"
Return value
A Promise
.
Specifications
Specification |
---|
The Screen Orientation API # dom-screenorientation-lock |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
lock |
38 |
79 |
43 |
No |
25 |
No |
38 |
38 |
43 |
25 |
No |
3.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/lock