禁用浏览器位置提示



好的,所以我一直在玩html5地理位置今晚,我想知道是否有一种方法可以禁用浏览器提示用户选择是否他们可能/或可能不想让我的网站跟踪他们?因为我需要跟踪他们,以获得准确的时区,和类似的东西,但如果用户拒绝从定位他们的网站,我现在有时区,州,城市,zip等.....我猜我在寻找更多的黑客!!jQuery代码:

  jQuery("#btnInit").click(initiate_watchlocation);  
  jQuery("#btnStop").click(stop_watchlocation); 
  var watchProcess = null; 
  function handle_errors(error)  
        {  
            switch(error.code)  
            {  
                case error.PERMISSION_DENIED: alert("Yo");  
                break;  
                case error.POSITION_UNAVAILABLE: alert("could not detect current position");  
                break;  
                case error.TIMEOUT: alert("");  
                break;  
                default: alert("unknown error");  
                break;  
            }  
        } 
function initiate_watchlocation() {  
    if (watchProcess == null) {  
        watchProcess = navigator.geolocation.watchPosition(handle_geolocation_query, handle_errors);  
    }  
}  
function stop_watchlocation() {  
    if (watchProcess != null)  
    {  
        navigator.geolocation.clearWatch(watchProcess);  
        watchProcess = null;  
    }  
}
function handle_geolocation_query(position) {  
    var text = "Latitude: "  + position.coords.latitude  + "<br/>" +  
               "Longitude: " + position.coords.longitude + "<br/>" +  
               "Accuracy: "  + position.coords.accuracy  + "m<br/>" +  
               "Time: " + new Date(position.timestamp);  
                jQuery("results").html(text);  
}  

你不能。

W3C在文档中写了关于地理位置API的安全和隐私注意事项。每个实现地理定位API的浏览器都必须遵循此规则。

最新更新