如果被拒絕,請再次詢問地理位置許可

[英]ask for geolocation permission again if it was denied


im building an app through phonegap, with a geolocation button.

即時通過phonegap構建應用程序,帶有地理定位按鈕。

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')
}

1 个解决方案

#1


17  

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).

您唯一能做的就是在瀏覽器的設置中顯示重新激活位置共享的說明(https://support.google.com/chrome/answer/142065?hl=zh-CN)。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/12/19/72a345443a0d9125b951aa2d42bd3f98.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com