docs.rodeo

MDN Web Docs mirror

Device orientation events

{{DefaultAPISidebar("Device Orientation Events")}} {{securecontext_header}} 

Device orientation events are events that allow you to detect a device’s physical orientation, as well as allowing you to detect the device’s motion.

Concepts and usage

Mobile devices commonly have sensors such as gyroscopes, compasses, and accelerometers that can enable applications running on the device to detect the device’s orientation and motion.

The device orientation events enable you to write web applications that can change their behavior based on the orientation of the user’s device, and that can react when the user moves their device.

Some typical features for which you might want to use the device orientation events include:

[!NOTE] This API is widely supported on mobile browsers. While some desktop-only browsers may have limitations due to hardware differences, these constraints are rarely significant given the API’s primary usage on sensor-equipped devices.

Interfaces

Extensions to other interfaces

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN