Generic Sensor API
Enables motion-based UX (shake to undo, tilt to scroll), compass features, step counting, and AR experiences. The unified permission model means understanding the base Sensor lifecycle covers all sensor types.
What It Defines
Base specification for hardware sensor access in the browser. Defines the Sensor base class, SensorErrorEvent, and the permission/lifecycle model. Concrete sensors: Accelerometer (linear acceleration), Gyroscope (angular velocity), Magnetometer (magnetic field), AbsoluteOrientationSensor, RelativeOrientationSensor, AmbientLightSensor, and GravitySensor.
Canonical (Normative)
Convenient (Practical)
Related References
Publishes web platform specs including CSS, accessibility, security policies, Service Workers, Web App Manifest, and many browser APIs. Also maintains some versioned HTML/DOM specs.
Related Specs
The gating mechanism for every sensitive browser API. Check permission state before requesting access to avoid unexpected prompt dialogs. The change event lets you react when users revoke permissions in browser settings.
Required for maps, location-based search, delivery tracking, geofencing, and any feature that needs the user's physical location. Understanding accuracy levels (GPS vs Wi-Fi vs IP) and the permission flow is essential.