JavaScript Battery Status API


  1. Note that the Battery Status API is no longer available due to privacy reasons where it could be used by remote trackers for user fingerprinting.

  2. The Battery Status API is an Application Programming Interface for the client's battery status. It provides information on:

    • battery charging state via 'chargingchange' event and battery.charging;
    • battery level via 'levelchange' event and battery.level;
    • charging time via 'chargingtimechange' event and battery.chargingTime;
    • discharging time via 'dischargingtimechange' event and battery.dischargingTime.
  3. MDN Docs: