Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

この記事は技術レビューを必要としています。ぜひご協力ください

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

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 compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support No support (Yes) moz[1] 11 ms[2] No support No support
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support (Yes)[3] (Yes) moz[1] No support No support No support

[1] This API is currently in draft form. It is only implemented as a prefixed method (mozUnlockOrientation) in B2G and Firefox for Android.

[2] This API is implemented using a prefix (msUnlockOrientation) in Internet Explorer for Windows 8.1 and Windows RT 8.1. It is not supported on Windows 7.

[3] This API is implemented with the draft version that uses the window.screen.orientation.lock / window.screen.orientation.unlock syntax

See also

ドキュメントのタグと貢献者

 このページの貢献者: avgp, Sebastianz, teoli, dstorey, kscarfone, Prachi_Dighe, justinpotts, Jeremie
 最終更新者: avgp,