0

html5 の地理位置情報 API を使用して開発している Web アプリケーションで、この奇妙な動作を発見しました。この問題は、Web サイトがブックマーク され、ヘッダーで使用する iPad で 全画面表示モードで実行されている場合にのみ発生します。<meta name="apple-mobile-web-app-capable" content="yes" />

私が使用しているコード:

function getLocation() {
  if (navigator.geolocation) {
    alert("No problem up to here");
    navigator.geolocation.getCurrentPosition(showPosition, noLocation, { timeout:   10000 });
}
else {
  alert("Geolocation is not supported by this browser.");
}
}

function showPosition(position) {
  alert("position: " + position.coords.latitude + ', ' + position.coords.longitude);
}

function noLocation(error) {
  alert("error.code:" + error.code);
}    

そして、別の関数から getLocation() を呼び出しています。

    timer = window.setInterval(function () { getLocation() }, 10000);

(そして、はい、私はすでにタイマーを宣言しています)

「チョーク」という言葉を使用したのは、10 秒ごとに「ここまで問題ありません」アラートが表示されposition:、 「position:error.code:

なぜこれが起こっているのですか?

4

0 に答える 0