每当我的页面加载到HTML5时,如何重置地理位置服务设置 [英] how do i reset the geolocation service settings each time my page loads in HTML5

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

问题描述

您好我正在一个网页上工作,我需要获得用户访问位置的许可。



但根据我的故事。我需要确保如果任何特定用户以前选择了拒绝然后在每个页面加载我需要向他显示一个提示说:
$ b

[网站]想要使用您的计算机位置如下图所示:

但另一方面,如果用户选择了允许它不应该再提示。



有没有简单而直接的方法来实现此功能JS或HTML5设置?

解决方案

这是不可能的。



请参阅:



浏览器处理这一点,一旦做出选择,你不能扭转它。如果您的网站需要地理定位才能正常工作,则可以始终检查是否授予了权限(请参阅:是否有一种方法可以检查地理位置是否已经使用Javascript进行了DECLINED?),如果没有,您应该更改网站的内容或行为,你的用户知道发生了什么。


hi 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 snapshot below:

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

Is there any easy and straight forward way to achieve this functionality with JS or HTML5 settings ?

解决方案

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.

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

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