【发布时间】:2011-05-27 04:57:19
【问题描述】:
有时我想知道用户是否没有选择分享他的位置。当共享位置弹出关闭而不共享时,是否会调用事件?
PS:当用户不分享他的位置时,错误回调不会被调用。
【问题讨论】:
标签: html geolocation
有时我想知道用户是否没有选择分享他的位置。当共享位置弹出关闭而不共享时,是否会调用事件?
PS:当用户不分享他的位置时,错误回调不会被调用。
【问题讨论】:
标签: html geolocation
这个话题回答了同样的问题: Geolocation feedback while accepting the request
我复制了下面的一些代码,但请检查页面,因为有一个示例说明如何处理它们,不接受或拒绝但在超时时忽略请求。
// navigator.geolocation.getCurrentPosition(successCallback, errorCallback, options);
navigator.geolocation.getCurrentPosition(
function(position){
//do something with position;
}, function(error){
// error passed to function
//handle condition where position is not available
//more specifically you can check the error code...
//error.code == 1
if(error.PERMISSION_DENIED){
alert("you denied me! ");
}
});
【讨论】:
阅读这篇文章将为您提供有关您所要求的内容的良好指南。 http://diveintohtml5.ep.io/geolocation.html
还有
【讨论】: