如果被拒绝,请再次询问地理位置许可
即时通过phonegap构建应用程序,带有地理定位按钮。
如果用户第一次拒绝地理定位权限,当他们再次点击地理定位按钮时,如何再次请求权限?
我目前的代码结构是:
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') }
你不能。
您唯一能做的就是在浏览器的设置中显示重新激活位置共享的说明( https://support.google.com/chrome/answer/142065?hl=zh-CN )。