2

I want to enable browser geolaction automatically, as i am getting a confirmation dialog while accessing geolocation to allow or deny, i dont want any confirmation dialog. Below is the scrreenshot of confirmation dialog while accessing geolocation in google chrome

4

2 回答 2

0

不可能。这适用于用户的PRIVACY POLICY

地理位置支持是可选的。这意味着您的浏览器永远不会强迫您向远程服务器透露您当前的物理位置。用户体验因浏览器而异。

这被称为位置感知浏览

来源DiveIntoHTML5

问:地理位置听起来很可怕。我可以关掉它吗?

答:当您谈论与远程 Web 服务器共享您的物理位置时,隐私是一个明显的问题。地理定位 API 明确规定:“未经用户明确许可,用户代理不得向网站发送位置信息。” 换句话说,共享您的位置始终是选择加入的。如果你不想,你不必。

这在每种浏览器中的处理方式不同,但在理论上很常见。

但是您可以使用Modernizr明智地处理它

function get_location() {
  if (Modernizr.geolocation) {
    navigator.geolocation.getCurrentPosition(show_map);
  } else {
    // no native support; maybe try a fallback?
  }
}
于 2013-08-05T06:58:27.043 回答
0

我不认为这是可能的。您不能强制浏览器允许或拒绝配置(安全原因)

于 2013-08-05T06:43:00.997 回答