This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The DeviceLightEvent provides web developers with information from photo sensors or similiar detectors about ambient light levels near the device. For example this may be useful to adjust the screen's brightness based on the current ambient light level in order to save energy or provide better readability.


The level of the ambient light in lux.


window.addEventListener('devicelight', function(event) {


Specification Status Comment
Ambient Light Sensor
The definition of 'Ambient Light Events' in that specification.
Working Draft Initial specification

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support No Yes

60 — 621 2


No No No
value No Yes22 — 62 No No No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No No Yes

60 — 621 2


No No ?
value No No Yes15 — 62 No No ?

1. See bug 1359076 and bug 1462308.

2. From version 60 until version 62 (exclusive): this feature is behind the device.sensors.ambientLight.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.

3. Not supported for macbook with touchbar and Windows 7.

See also