每当我的页面使用HTML5和Javascript加载时,如何重置地理位置服务设置 [英] How do i reset the geo-location service settings each time my page loads with HTML5 and Javascript

查看:68
本文介绍了每当我的页面使用HTML5和Javascript加载时,如何重置地理位置服务设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个网页,我需要在该网页上获得用户的访问权限.

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.

是否有任何简单明了的方法即可通过JS或HTML5设置实现此功能?如果不是,那么我还可以做些什么才能实现此功能?

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?

推荐答案

这是不可能的.

请参阅:如何制作Google Maps再次请求位置权限?

浏览器会处理此问题,一旦做出选择,您将无法撤消它.如果您的网站要求地理位置才能正常工作,则您可以随时检查是否已获得许可(请参见此处:

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.

这篇关于每当我的页面使用HTML5和Javascript加载时,如何重置地理位置服务设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆