Javascript HTML地理定位服务强制随时接受
对于我们的Web应用程序,我们使用HTML 5定位服务,如下所示:Javascript HTML地理定位服务强制随时接受,javascript,html,Javascript,Html,对于我们的Web应用程序,我们使用HTML 5定位服务,如下所示: // does the service work n this browser if(navigator.geolocation) { // get position navigator.geolocation.getCurrentPosition(function(position) { // there is something wrong }, function(error
// does the service work n this browser
if(navigator.geolocation) {
// get position
navigator.geolocation.getCurrentPosition(function(position) {
// there is something wrong
}, function(error) {
},{timeout:maptimer});
// location service does not work on this browser
}else{
}
我的(Firefox)浏览器要求我接受此功能。Firefox给了我两个选择:
- 永远接受
- 只接受这一次
有没有办法强制(在我的代码中)定位服务只提示“始终接受”选项?您不能。用户界面权限仅由浏览器供应商控制,不指定覆盖权限的方式
顺便说一下,在Firefox24上,我看到的默认按钮是“共享位置”,它有一个下拉菜单,上面有“始终共享位置”、“从不共享位置”和“不现在”。我明白为什么您会要求默认情况下始终共享,但为了保护用户的隐私,这无法做到。不。这违反了浏览器的安全模型。只有用户可以在浏览器选项中设置。不,您不能强制用户始终接受,这是一个关于安全性的问题。