Battery API is not working on chrome pop up window

人走茶凉 提交于 2019-12-13 02:46:53

问题


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?


回答1:


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




回答2:


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

navigator.webkitBattery not working in Google chrome



来源:https://stackoverflow.com/questions/11446407/battery-api-is-not-working-on-chrome-pop-up-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!