Device Orientation API
Access device orientation and motion data
Not Supported
The Device Orientation API is not supported in your browser or device.
Orientation Data
Real-time device orientation values
Alpha (Z-axis)
N/ABeta (X-axis)
N/AGamma (Y-axis)
N/ADevice Information
Current device state and permissions
Absolute OrientationNo
Axis Information
- • Alpha: Rotation around Z-axis (0° to 360°)
- • Beta: Rotation around X-axis (-180° to 180°)
- • Gamma: Rotation around Y-axis (-90° to 90°)
Documentation
Understanding the Device Orientation API
What is the Device Orientation API?
The Device Orientation API provides access to the device's physical orientation and motion data. It allows web applications to respond to changes in device orientation and movement.
Key Features
- Access device orientation angles (alpha, beta, gamma)
- Support for absolute and relative orientation
- Permission-based access control
- Real-time orientation updates
- Cross-browser compatibility
Browser Support
The Device Orientation API is supported in most modern browsers on mobile devices. Some browsers may require HTTPS and explicit user permission.
Best Practices
- Always check for API support
- Request permissions when needed
- Handle null values gracefully
- Clean up event listeners
- Consider device compatibility
Example Use Cases
- Virtual reality experiences
- Interactive games
- Augmented reality applications
- Device motion tracking
- Orientation-based UI adjustments