【发布时间】: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 地图应用程序时,它显示了一个完美的立即定位(即使我有一段时间不使用它)
我知道我可以使用超时选项来处理错误回调,但这不是我的解决方案。
谢谢!
【问题讨论】:
-
似乎与 [Cordova 3.1 and Phone Gap Geolocation failed with “Position检索 timed out on Android][1] [1]: stackoverflow.com/questions/19567798/…
标签: javascript android html geolocation geo