即時建立通過電話,與地理位置按鈕的應用程序。再次請求地理位置權限,如果它被拒絕
如果用戶第一次拒絕地理位置權限,那麼當他們再次單擊地理位置按鈕時,如何再次請求權限?此刻
我的代碼結構爲:
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')
}
是不是你已經有了:'showError('地理位置未啓用。請啓用此功能')????無論如何,請參閱:http://jsfiddle.net/W772a/ –