Obsolete since Gecko 50 (Firefox 50 / Thunderbird 50 / SeaMonkey 2.47)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

The battery read-only property returns a BatteryManager provides information about the system's battery charge level; provides also some new events you can handle to monitor the battery status. This implements the Battery Status API; see that documentation for additional details, a guide to using the API, and sample code.

The battery property has been removed in favor of the standard Navigator.getBattery() method, which returns a battery Promise. Its support is still partial though.

Syntax

var battery = navigator.battery;

Specifications

Specification Status Comment
Battery Status API
The definition of 'Navigator.battery' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Deprecated
Chrome Full support 38Edge ? Firefox 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 Requires 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 ? Chrome Android Full support 38Edge Mobile ? Firefox 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 Requires 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 ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
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

Document Tags and Contributors

Last updated by: connorshea,