【问题标题】:Geolocation in Mozila Firefox: Both success and error triggeredMozilla Firefox 中的地理位置:触发成功和错误
【发布时间】:2016-06-30 14:06:39
【问题描述】:

如果我在 Mozilla Firefox 中使用地理定位并将超时设置小于 ca 7 秒 (更新 - FF 47.0.1 中的 ca 4 秒),它会返回成功和错误(3 - 位置获取定时出去)。如果未设置超时或设置的时间足够长,则可以正常工作(返回成功)。在 Windows 7 和 Android 上的 Mozilla Firefox 47.0 中测试。 见this example。

<h1>Geolocation test</h1>
<div id="results"></div>

<script>
  document.getElementById("results").innerHTML = "Let's begin<br>";

  navigator.geolocation.getCurrentPosition(positionIs, positionIsNot, {
    enableHighAccuracy : false,
    maximumAge: 0,
    timeout: 4000
  });

  function positionIs(position) {
    document.getElementById("results").innerHTML += "SUCESS: " + position.coords.latitude + "; " + position.coords.longitude + "; " + position.coords.altitude + "<br>";
  }

  function positionIsNot(err) {
    document.getElementById("results").innerHTML += "ERROR: " + err.code + " " + err.message + "<br>";
  }

</script>

其他浏览器没有问题。 我有什么问题还是错误?

【问题讨论】:

    标签: javascript html firefox geolocation


    【解决方案1】:

    这是 47+ 版本中的错误,请参阅https://bugzilla.mozilla.org/show_bug.cgi?id=1283563

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-17
      • 2012-03-26
      • 1970-01-01
      相关资源
      最近更新 更多