【问题标题】:navigator geolocation getCurrentPosition not working导航器地理位置 getCurrentPosition 不起作用
【发布时间】:2013-09-29 13:49:57
【问题描述】:

我有这个 html 页面:

<!DOCTYPE html>
<html>
<head>
    <title>Geolocation test</title>
</head>
<body>
    <script type="text/javascript">
        navigator.geolocation.getCurrentPosition(function (position) {
            alert(position.coords.latitude + ',' + position.coords.longitude);
        }, function (error) {
            alert(error.code);
        }, {enableHighAccuracy: true, maximumAge: 0});
    </script>
</body>

适用于:

  • 三星 Galaxy 3 谷歌浏览器
  • 三星 Galaxy 3 原生网络浏览器
  • Chrome 桌面。

不适用于:

  • 三星 Galaxy S2 Chrome
  • 三星 Galaxy S2 原生
  • 桌面版 Firefox

我已经阅读了很多关于这个问题的问题,但是他们都说有时位置不可用或者可能需要很长时间才能检索到它,但是当我打开 android 地图应用程序时,它显示了一个完美的立即定位(即使我有一段时间不使用它)

我知道我可以使用超时选项来处理错误回调,但这不是我的解决方案。

谢谢!

【问题讨论】:

标签: javascript android html geolocation geo


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-03
    • 1970-01-01
    • 2012-07-28
    • 2021-03-22
    • 2013-05-27
    • 1970-01-01
    • 2016-04-29
    • 1970-01-01
    相关资源
    最近更新 更多