Battery Status API and drain inference
Reads battery level, charging state and time estimates in Chromium browsers.
In one line
Can see your battery level and charging state in Chromium browsers
Reads battery level, charging state and time estimates in Chromium browsers.
Level and discharge time can short-term link visits across sites. Remaining time infers device load. Removed from Firefox and never added to Safari because of the tracking risk.
What it can and can't do
What the user does: Nothing. It happens when the page loads, or when a page checks power use
It can
- Check your battery level and if you are charging
- Check how long until it is full or empty
- Use short lived numbers to link two visits close together
It cannot
- Get battery info in Firefox, which removed it, or in Safari, which never added it
- Ask permission first
- Know who you are by itself
- Tell what apps you run
How it differs between platforms: Chrome, Edge and Samsung Internet allow it. Firefox removed it and Safari never added it because of tracking worries.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 38 | 2014-10-07 | Secure contexts only since 103 |
| Edge | Supported | 79 | 2020-01-15 | Secure contexts only since 103 |
| Firefox | Removed | 52 | 2017-03-07 | Removed in 52 (2017) |
| Safari | Not supported | Not available | Not listed | None |
| Safari on iPhone | Not supported | Not available | Not listed | None |
| Chrome on Android | Supported | 38 | 2014-10-08 | Secure contexts only since 103 |
| Samsung Internet | Supported | 3.0 | 2015-04-10 | Secure contexts only since 103 |
How a site asks for it
| API | navigator.getBattery(); BatteryManager level, charging, chargingTime, dischargingTime |
| Permissions policy | battery |
| Browser compat keys | api.Navigator.getBattery |
| How access is granted | none |
| What the user sees | Not listed |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | Not listed |
| How to take it back | Not listed |
| Inside an iframe | Not listed |
Typical flow
- Call getBattery (secure context)
- Read BatteryManager fields and events
Data you get
What comes back: 4 fields
Shape: object
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
level | float | fraction | 0 to 1 | 1% steps (bucketed to 1% on Chrome) |
charging | boolean | None | true or false | exact |
dischargingTime | float | s | 0 to Infinity | 15 minute rounding |
Technical limits
- Cannot read battery on iOS or Firefox
- Can't see battery health, only level
The story
What it is
A page reads your battery level, whether you are charging and time left. Only some browsers allow it.
For you
You get no prompt. A page might switch to a lighter mode or pause fancy effects when your battery is low. Researchers showed it could be used to track people, so Firefox and Safari left it out.
For makers
Makers use it to save power and avoid draining a phone in the middle of a game or video. It also works as a small device signal, which is why privacy minded browsers removed it.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser game lowers the frame rate and effects when you are under 20 percent battery. | None named |
| video | A streaming site picks a lower resolution on low battery to let you finish the movie. | YouTube |
| video | A video call tool turns off background blur when your laptop is unplugged and low. | Google Meet |
| productivity | A web editor saves your work sooner when battery is about to die. | None named |
| ads | A tracker combines battery level and time to charge as a short lived device ID. | None named |
| shopping | Privacy researchers warned that a shop could change prices for people with a low battery, which is one reason the feature was removed. | None named |
| fitness | A web workout player skips heavy animations on a phone that is almost out of power. | None named |
Risks
- Can be used for tracking
- Removed from Firefox and Safari
What the platform says
- MDN: Battery Status API. Lets a page see the device's battery level and charging state, so it can save power when low.
Good uses and abuse
Legitimate uses
- Low-power modes for apps
Known abuse
- Short-term device linking (Olejnik 2015), retail price discrimination claims
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 2 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 3 | Rough identifying entropy, when known |
History
- 2016-10, Firefox 52: Battery API removed over privacy concerns
- 2022-08, Chrome 103: Restricted to secure contexts and permissions policy battery
Related capabilities
Related
- Page Visibility, focus and blur. Can tell when you switch tabs, minimise the browser or lock the screen
Sources
How well checked: Based on official documentation.