How do i reset the geo-location service settings each time my page loads with HTML5 and Javascript

别等时光非礼了梦想. 提交于 2019-12-13 12:51:27

问题


I am working on a web page where I need to get permission from a user to access location.

but according to my story. I need to make sure that if any particular user has selected Deny previously then on each page load I need to show him a prompt saying

[website] want to use your computer's location as shown in the snapshot below:

But on the other hand, if the user has selected Allow it should not prompt anymore.

Is there any easy and straightforward way to achieve this functionality with JS or HTML5 settings? If not then what else I could do in order to achieve this functionality?


回答1:


This is not possible.

See: How to make Google Maps to request again for location permissions?

The browser handles this and once a choice has been made, you cannot reverse it. If your site requires geolocation to work, you can always check if the permission is given (see here: Is there a way to check if geolocation has been DECLINED with Javascript?) and if not, you should change the content or behaviour of the site, so your users know what's going on.



来源:https://stackoverflow.com/questions/27014154/how-do-i-reset-the-geo-location-service-settings-each-time-my-page-loads-with-ht

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!