ScreenOrientation

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

A ScreenOrientation instance object can be retrieved using the screen.orientation property.

EventTarget ScreenOrientation

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 event handler 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
The Screen Orientation API
# screenorientation-interface

Browser compatibility

BCD tables only load in the browser