2

私はクロスプラットフォームアプリケーションに取り組んでいます。navigator.geolocation は正常に機能していましたが、過去 2 日間から Google 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 が返されました。

4

2 に答える 2

1

最新のクロムは、安全でないオリジンでこの API を非推奨にしました:

https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins

起動して実行する時間https://localhost;)

今後のクエリについては... https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only?hl=en

于 2015-09-01T14:27:08.350 に答える
1

これは現在修正されているようです。Googleが行ったサーバー側の変更による問題だったに違いありません。デバッグ中に、 https://www.google.comのコンソールで getCurrentPosition() 呼び出しを実行したときでも、レート制限の問題が発生しました。

于 2015-09-02T02:02:39.270 に答える