Navigator.battery

The battery read-only property returns a BatteryManager which provides information about the system's battery charge level and whether the device is charging and exposes events that fire when these parameters change. This interface was introduced in early drafts of the Battery Status API and but has been replaced with Promise-based Navigator.getBattery().

The battery property has been removed in favor of the standard Navigator.getBattery() method, which returns a battery Promise.

Syntax

var battery = navigator.battery;

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
battery
Deprecated
Chrome No support 20 — 29
Prefixed
No support 20 — 29
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Edge No support NoFirefox No support 16 — 50
Notes
No support 16 — 50
Notes
Notes Removed in favor of navigator.getBattery().
Notes The Battery API was supported on Android, Windows, and Linux with UPower installed. Support for macOS was available starting with Firefox 18.
No support 11 — 16
Prefixed
Prefixed Implemented with the vendor prefix: moz
No support 10 — 16
Disabled
Disabled From version 10 until version 16 (exclusive): this feature is behind the dom.battery.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support 16 — 50
Notes
No support 16 — 50
Notes
Notes Removed in favor of navigator.getBattery().
Notes The Battery API was supported on Android, Windows, and Linux with UPower installed. Support for macOS was available starting with Firefox 18.
No support 14 — 16
Prefixed
Prefixed Implemented with the vendor prefix: moz
No support 10 — 16
Disabled
Disabled From version 10 until version 16 (exclusive): this feature is behind the dom.battery.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

No support  
No support
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also