The Screen Orientation API allows web applications to get the information about the current orientation of the document (portrait or landscape) as well as to lock the screen orientation in a requested state.
The current version of the specification defines this feature fully within
window.screen.orientation object. The previous version, still available in Microsoft Edge as of June 2017, separated the orientation lock to
- Returns the current screen orientation type as one of
- An event fired when the document orientation has changed.
- Requests a screen lock in the
lockTypespecified. Returns a
Promiseresolved when the lock was acquired successfully.
- Removes previously acquired screen orientation lock.