sensor

ambient-light-sensor

The sensor policies are ambient-light-sensor, accelerometer, gyroscope, and magnetometer.

A sensor feature controls access to a device sensor of a certain type requested either through an associated Sensor-based interface or through an event specified in the DeviceOrientation Event Specification.

If an interface (or an event) requires access to multiple sensors of different types than each of the corresponding sensor features MUST be allowed in order to use this interface. The table below shows which sensor features are required by the existing interfaces and events.

How to apply this policy

Send the following HTTP header to control the ambient-light-sensor policy, and disallow it on all origins:

Feature-Policy: ambient-light-sensor 'none'

Does it work?

Currently Firefox, and Chromium based browsers, such as Google Chrome, Samsung Internet, and Opera, are the only user-agents to support Feature Policy. The minimum version that correctly recognises the ambient-light-sensor policy is:

Mozilla Firefox

Not supported

Google Chrome

69+

Microsoft Edge

Not supported

Apple Safari

Not supported

Discussion