Version: Smart Feature Phone 2.5

BatteryManager.present

A Boolean value indicating whether or not the device's battery is present

Syntax#

var present = navigator.battery.present

On return, present indicates whether or not the battery is present. If battery connects to device, the return value is true. Otherwise, the value is false.

Example#

HTML Content#

<div id="present">(present state unknown)</div>

JavaScript Content#

navigator.getBattery().then(function(battery) {
var present = battery.present;
document.querySelector('#present').textContent = present ;
});