When doing positioning, you will be asked for the first time. If your authorization is passed and the positioning is successful, the next time you need positioning, you will not be asked to directly obtain the positioning information.
But if you reject the authorization for the first time, you won’t be able to position it again (because you won’t ask the user, and you won’t be able to use it after you reject it for the first time).
I would like to ask what is the mechanism of this inquiry? Why only ask once? If the positioning is rejected for the first time, it will no longer be used. How to do it?
Code:
function getLocation(){
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(showPosition,showError,{
});
}
else{
alert("浏览器不支持地理定位。");
}
}
A fight with the browser manufacturer may solve the problem.
First, confirm that the browser supports location services, and then still perform location acquisition. If an error is returned, such as error.PERMISSION_DENIED, a prompt will be displayed to inform the browser that positioning is disabled. You can go to the browser settings, clear the website cache, and then try again. Try it, or ask customers to consult the browser manufacturer directly! Please refer to the mobile version of Baidu News webpage!