Google Chrome地理位置无效

时间:2015-09-01 11:37:08

标签: javascript google-chrome geolocation w3c-geolocation

我正在开发跨平台应用程序。 navigator.geolocation工作正常,但自从过去2天以来它只是在谷歌Chrome中出现问题。 api是否已弃用或此api的其他问题?我在许多不同的浏览器和网络上测试了以下代码,但仍然存在同样的问题。

var options = {
  enableHighAccuracy: true,
  timeout: 5000,
  maximumAge: 0
};

function success(pos) {
  var crd = pos.coords;

  console.log('Your current position is:');
  console.log('Latitude : ' + crd.latitude);
  console.log('Longitude: ' + crd.longitude);
  console.log('More or less ' + crd.accuracy + ' meters.');
};

function error(err) {
  console.warn('ERROR(' + err.code + '): ' + err.message);
};

navigator.geolocation.getCurrentPosition(success, error, options);

错误(2):网络位置提供商位于“https://www.googleapis.com/”:返回错误代码403.

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

现在似乎已修复。由于Google制作的服务器端更改,一定是个问题。当我调试时,我看到了速率限制问题,即使我在https://www.google.com的控制台中运行了getCurrentPosition()调用。