ScreenOrientation

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The ScreenOrientation interface of the the Screen Orientation API provides information about the current orientation of the document.

Properties

ScreenOrientation.typeRead only
Returns the document's current orientation type, one of "portrait-primary", "portrait-secondary", "landscape-primary", or "landscape-secondary".
ScreenOrientation.angleRead only
Returns the document's current orientation angle.

Event handlers

ScreenOrientation.onchange
The EventHandler called whenever the screen changes orientation.

Methods

ScreenOrientation.lock()
Locks the orientation of the containing document to its default orientation and returns a Promise.
ScreenOrientation.unlock()
Unlocks the orientation of the containing document from its default orientation.

Specifications

Specification Status Comment
Screen Orientation API
The definition of 'ScreenOrientation' in that specification.
Working Draft Initial definition.

Browser Compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
ScreenOrientationChrome Full support 38Edge Full support 79Firefox Full support 43IE No support NoOpera Full support 25Safari No support NoWebView Android Full support 38Chrome Android Full support 38Firefox Android Full support 43Opera Android Full support 25Safari iOS No support NoSamsung Internet Android Full support 3.0
angleChrome Full support 38Edge Full support 79Firefox Full support 43IE No support NoOpera Full support 25Safari No support NoWebView Android Full support 38Chrome Android Full support 38Firefox Android Full support 43Opera Android Full support 25Safari iOS No support NoSamsung Internet Android Full support 3.0
lockChrome Full support 38Edge Full support 79Firefox Full support 43IE No support NoOpera Full support 25Safari No support NoWebView Android Full support 38Chrome Android Full support 38Firefox Android Full support 43Opera Android Full support 25Safari iOS No support NoSamsung Internet Android Full support 3.0
onchangeChrome Full support 38Edge Full support 79Firefox Full support 43IE No support NoOpera Full support 25Safari No support NoWebView Android Full support 38Chrome Android Full support 38Firefox Android Full support 43Opera Android Full support 25Safari iOS No support NoSamsung Internet Android Full support 3.0
typeChrome Full support 38Edge Full support 79Firefox Full support 43IE No support NoOpera Full support 25Safari No support NoWebView Android Full support 38Chrome Android Full support 38Firefox Android Full support 43Opera Android Full support 25Safari iOS No support NoSamsung Internet Android Full support 3.0
unlockChrome Full support 38Edge Full support 79Firefox Full support 43IE No support NoOpera Full support 25Safari No support NoWebView Android Full support 38Chrome Android Full support 38Firefox Android Full support 43Opera Android Full support 25Safari iOS No support NoSamsung Internet Android Full support 3.0

Legend

Full support
Full support
No support
No support