Web APIs

Screen Orientation API

Checking compatibility...

Access and control the screen orientation of a device. Lock the orientation or respond to orientation changes in your web applications.

Basic Orientation Control

Find out which way a device is being held and control its orientation. This example shows how to detect if a phone or tablet is in portrait or landscape mode, and how to lock it to your preferred orientation.

=
=
=
=
=
=

Output

Click Run to see output...

Visual Orientation Demo

See orientation changes in action with a visual device mockup. This interactive demo shows all possible device orientations and how they relate to rotation angles, helping you understand how the API works across different devices.

=
=
=
=
=
=

Output

Click Run to see output...