开发者

Android 2.2.1 bug preventing browser-based geolocation?

On Android, users are getting error code "1" -- which is "permission denied." However, the users I'm working with were never ASKED permission by the browser for geolocation.

I've tried calling getCurrentPosition with and without "enableHighAccuracy" but the error is the same regardless.

Anyone experienced this?

<script type="text/javascript">
if (Modernizr.geolocation) {
   navigator.geolocation.getCurrentPosition(show_map, handle_error)
开发者_StackOverflow}
function show_map(position) {
  var latitude = position.coords.latitude;
  var longitude = position.coords.longitude;
        if (document.myform) {
            document.myform._lat.value = latitude;
            document.myform._lon.value = longitude;
        }
}
function handle_error(err) {
  alert('Error code: ' + err.code + ' Could not get your location.');
}
</script>


This may vary depending on which ROM one is using, but there's an option in my browser to enable location requests. If it is unchecked, all location requests are ignored with no prompt. Could that be what's happening to your users?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜