This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

NavigatorBattery

Summary

The NavigatorBattery interface is exposed on the Navigator object.

Properties

battery
The object that exposes the battery status information.

Methods

No methods.

Events

No events.

Examples

navigator.battery.onlevelchange = function () {
  console.log(navigator.battery.level);
};

/* or alternatively */

navigator.battery.addEventListener('levelchange', function () {
  console.log(navigator.battery.level);
}, false);

Related specifications

Battery Status API
W3C Last Call Working Draft