0

我有一个具有权限设置的 chrome 应用程序,其中之一是地理位置。它有一个沙箱 index.html 我想从那个 index.html 获取用户位置。有什么方法可以从该页面获取地理位置。

function success(position){

}
function error(){
  console.log('unable to track user location now')
}
var id = navigator.geolocation.watchPosition(success, error, options);

给出错误用户拒绝的位置。我没有看到弹出这个页面是请求地理定位许可

4

1 回答 1

0

沙盒没有获得应用程序被授予的权限(这正是沙盒的重点),并且 Chrome 应用程序 UI 不允许权限提示。

因此,沙盒页面永远无法获得该权限。您将需要从非沙盒页面执行地理定位并与沙盒通信

于 2016-09-01T09:07:09.850 回答