本文介绍了如果被拒绝,再次请求地理定位许可的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果用户第一次拒绝地理定位许可,我怎么能再次要求许可? 再次点击地理定位按钮?我现在的代码结构是:
function getLocation(){
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(showPosition,positionError);
$ b} else {
hideLoadingDiv()
showError('该设备不支持地理定位')
}
}
函数positionError(){
hideLoadingDiv()
showError('地理位置未启用,请启用此功能')
}
解决方案您可以执行的操作是在浏览器设置中显示重新激活位置信息分享的说明()。
im building an app through phonegap, with a geolocation button.
if a user denies permission for geolocation the first time, how can i ask for permission again when they click the geolocation button again?
my code structure at the moment is:
function getLocation() { if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition, positionError); } else { hideLoadingDiv() showError('Geolocation is not supported by this device') } } function positionError() { hideLoadingDiv() showError('Geolocation is not enabled. Please enable to use this feature') }
解决方案You can't.
The only thing you can do is to display the instructions to reactivate the location sharing in his browser's settings (https://support.google.com/chrome/answer/142065?hl=en).
这篇关于如果被拒绝,再次请求地理定位许可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!