OS Integration

Battery Status

Probing…

Battery Status is a web platform capability in the OS Integration category. Charge level and charging state. Supported in Chromium 38+; not available in Firefox and Safari. Requires a secure context (HTTPS or localhost).

Secure context

Try it

Loading demo…

Code

const battery = await navigator.getBattery()
console.log(battery.level, battery.charging)

battery.addEventListener('levelchange', () => {
  console.log('now at', Math.round(battery.level * 100), '%')
})

Browser support

Chromium
38
Firefox
No
Safari
No

Frequently asked questions

Which browsers support Battery Status?

Supported in Chromium 38+; not available in Firefox and Safari.

Does Battery Status require HTTPS?

Yes. Battery Status needs a secure context, so it only works over HTTPS (or on localhost during development).

What is Battery Status used for?

Charge level and charging state.

Can I try Battery Status in my browser?

Yes. shwcs.net runs a live Battery Status demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.

MDN reference ↗ Specification ↗