Battery API is not working on chrome pop up window

2019-09-06 05:48发布

is there a way to get the Battery object in chrome pop up windows

I am using this code to create pop up

chrome.windows.create({'url': 'mypop.html', 'type': 'popup'}, function(window) {
  });

but having problem to return the battery object using this code

var battery = navigator.webkitBattery;

when I am calling the javascript file on the mypop.html page.

Is it the chrome security issue that disallow battery object on pop up page?

2条回答
放我归山
2楼-- · 2019-09-06 06:14

Chrome developer advocate has replied over here on SO. Checkout this thread.

navigator.webkitBattery not working in Google chrome

查看更多
太酷不给撩
3楼-- · 2019-09-06 06:25

Looks like its been removed from Chrome as navigator.webkitBattery is undefined

查看更多
登录 后发表回答