Screen Orientation & Lock

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.

API glimpse

window.screen.orientation.type
Returns the current screen orientation type as one of portrait-primary, portrait-secondary (upside down), landscape-primary and landscape-secondary (upside down).
window.screen.orientation.addEventListener('change', listener)
An event fired when the document orientation has changed.
window.screen.orientation.lock(lockType)
Requests a screen lock in the lockType specified. Returns a Promise resolved when the lock was acquired successfully.
window.screen.orientation.unlock()
Removes previously acquired screen orientation lock.

Resources