browsersays

navigator.getBattery

The Battery Status interface: charge level, charging state and time remaining. Why it was removed from two browsers and what it still reveals in the third.

Checking the browser you are reading this in…

Entry in question 2: What it says about your machine

What it is

A function returning a promise for a battery object: how charged you are, whether you are plugged in, and estimates of how long until full or empty. It was designed so a page could reduce its own work when you were running low.

What a site can do with it

It is the standard example of a well-meant interface that turned out to be identifying. The combination of a precise charge level and a precise time estimate changes slowly and is unusual enough to link two visits together for a while, which is why two of the three major engines removed it rather than restricting it.

Check it yourself

Open your browser's developer tools, go to the console, and paste this. Nothing is sent anywhere; the answer comes from the browser you are reading this in.

typeof navigator.getBattery

The full path recorded by the walk is navigator.getBattery, and that is the string the leaflet prints beside this entry.

What the answer is on an ordinary browser

Written by hand for each of the three engines, because a table generated from one sentence would be worth nothing to the person reading it.

Chrome
Present on desktop and Android, with the reported values rounded.
Firefox
Removed in Firefox 52 and not restored.
Safari
Never implemented.

If your browser is not present, the leaflet prints this instead of dimming the line: Not present. Sites asking about your battery get nothing back.

Where it sits in the leaflet

This is one of 9 entries in question 2, what it says about your machine. The leaflet reads all 42 entries in one press and prints each answer beside the question, with the property name next to it so you can check any line.

Read my browser · navigator.connection · navigator.virtualKeyboard