HTML5地理位置,请求位置? [英] HTML5 Geolocation, ask for location?

查看:126
本文介绍了HTML5地理位置,请求位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能要求用户允许按需获取其位置?通常会询问页面何时请求位置,例如 navigator.geolocation ,但在页面重新加载并且脚本再次请求位置之后才会再次询问。

Is it possible to ask for the user's permission to get their location on demand? It's usually asked when the page asks for the location, such as navigator.geolocation, but won't ask again until after the page has reloaded and the script asks for the location again.

在用户点击否认之后,是否有按需询问,例如。)

Is there anyway to have it ask on demand, ex.) after the user hits deny?

推荐答案

您必须从另一个域请求位置,或提供有关如何进入其浏览器并更改设置的说明。就像在iPhone上一样,如果你不小心拒绝了一个许可,你将不得不进入设置。

You have to either request location from another domain, or provide instructions on how to go into their browser and change their settings. Just like on iPhone how you have to go into settings if you accidentally deny a permission.

这是因为许可要求实际上是以浏览器为基础实施的。您可以想象,如果地理位置在IE6天左右,IE6会自动始终接受。您的解决方案必须根据用户正在使用的浏览器执行。

It's because the permission-asking is actually something implemented on a per-browser basis. You can imagine if geolocation was around in IE6 days, IE6 would automatically always accept. Your solution would have to execute based on the browser someone is using.

这篇关于HTML5地理位置,请求位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆