-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
68 lines (48 loc) · 1.67 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: "Screen: unlockOrientation() method"
short-title: unlockOrientation()
slug: Web/API/Screen/unlockOrientation
page-type: web-api-instance-method
status:
- deprecated
browser-compat: api.Screen.unlockOrientation
---
{{APIRef("Screen Orientation API")}}{{Deprecated_Header}}
The **`Screen.unlockOrientation()`** method removes all the
previous screen locks set by the page/app. The {{DOMxRef("ScreenOrientation.unlock()")}}
method should be used instead.
> **Warning:** This feature is deprecated and should be avoided. Use the {{DOMxRef("ScreenOrientation.unlock()")}} method instead.
> **Note:** This method only works for installed Web apps or for Web pages
> in [fullscreen mode](/en-US/docs/Web/API/Fullscreen_API).
## Syntax
```js-nolint
unlockOrientation()
```
### Parameters
None.
### Return value
Returns `true` if the orientation was successfully unlocked or
`false` if the orientation couldn't be unlocked.
## Examples
```js
const unlockOrientation =
screen.unlockOrientation ||
screen.mozUnlockOrientation ||
screen.msUnlockOrientation ||
(screen.orientation && screen.orientation.unlock);
if (unlockOrientation()) {
// orientation was unlocked
} else {
// orientation unlock failed
}
```
## Specifications
This feature is not part of any specification. It is no longer on track to becoming a standard.
Use {{domxref("ScreenOrientation.unlock()")}} instead.
## Browser compatibility
{{Compat}}
## See also
- {{DOMxRef("Screen.orientation")}}
- {{DOMxRef("Screen.lockOrientation()")}}
- {{DOMxRef("Screen.orientationchange_event", "orientationchange")}} event
- [Managing screen orientation](/en-US/docs/Web/API/CSS_Object_Model/Managing_screen_orientation)