-2
好了,所以我一直在玩的HTML5地理位置今晚,我想知道有没有办法从提示用户从它们是否可能/或可能不想选择禁用浏览器允许我的网站跟踪他们?因为我需要跟踪他们到那里准确的时区,以及类似的事情,但如果用户拒绝网站定位他们,我现在有时区,州,城市,邮编等.....我猜什么即时通讯寻找更多的黑客! 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);
}
更具体地说,如果您找到一种避开权限提示的方法,则会发现安全漏洞,并且供应商将以高优先级对其进行修补。 – 2011-12-26 05:55:37