Screen.unlockOrientation()

« Screen

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use 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 spec changes.

Summary

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;

if (unlockOrientation()) {
  // orientation was unlocked
} else {
  // orientation unlock failed
}

Specifications

Specification Status Comment
Screen Orientation API Working Draft Draft specification

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support Not supported (Yes) moz 11 ms Not supported Not supported
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support Not supported Not supported (Yes) moz Not supported Not supported Not supported

Gecko notes

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

Trident notes

This method 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.

See also

Document Tags and Contributors

Contributors to this page: justinpotts, Jeremie, dstorey, Prachi_Dighe, kscarfone, teoli
Last updated by: teoli,