Battery statusLimited availability
The navigator.getBattery() API obtains information about the device's battery, including charge level and status. Also known as the Battery API.
Not yet supported in all major browsers — check the table and provide a fallback.
Browser support
DesktopChrome
1–37Not supported
38+Supportedsince Oct 7, 2014
Current: 155Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154Firefox
✕Not supportedup to 157
Current: 157Safari
✕Not supportedup to 27
Current: 27MobileChrome Android
18–37Not supported
38+Supportedsince Oct 8, 2014
Current: 155Firefox Android
✕Not supportedup to 157
Current: 157Safari iOS
✕Not supportedup to 27
Current: 27How to use
Not supported in Firefox, Safari, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.
Example
Full syntax and examples are on MDN: BatteryManager.
Feature detection
JS · check before using
if ("BatteryManager" in globalThis) {
// BatteryManager is available
} else {
// load a polyfill or use a fallback
}Sub-features
Support for each part of the feature (12). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| BatteryManager | 38 | 79 | ✕ | ✕ | 38 | ✕ | ✕ |
| BatteryManager.charging | 38 | 79 | ✕ | ✕ | 38 | ✕ | ✕ |
| BatteryManager.chargingTime | 38 | 79 | ✕ | ✕ | 42 | ✕ | ✕ |
| BatteryManager.chargingchange_event | 38 | 79 | ✕ | ✕ | 38 | ✕ | ✕ |
| BatteryManager.chargingtimechange_event | 38 | 79 | ✕ | ✕ | 38 | ✕ | ✕ |
| BatteryManager.dischargingTime | 38 | 79 | ✕ | ✕ | 42 | ✕ | ✕ |
| BatteryManager.dischargingtimechange_event | 38 | 79 | ✕ | ✕ | 38 | ✕ | ✕ |
| BatteryManager.level | 38 | 79 | ✕ | ✕ | 38 | ✕ | ✕ |
| BatteryManager.levelchange_event | 38 | 79 | ✕ | ✕ | 38 | ✕ | ✕ |
| BatteryManager.secure_context_required | 103 | 103 | ✕ | ✕ | 103 | ✕ | ✕ |
| Navigator.getBattery | 38 | 79 | ✕ | ✕ | 38 | ✕ | ✕ |
| Navigator.getBattery.secure_context_required | 103 | 103 | ✕ | ✕ | 103 | ✕ | ✕ |