Version: Smart Feature Phone 2.5


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


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.


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 ;