用户在javascript中阻止访问后请求位置坐标

用户在javascript中阻止访问后请求位置坐标,javascript,html,google-chrome,geolocation,progressive-web-apps,Javascript,Html,Google Chrome,Geolocation,Progressive Web Apps,如果用户在过去阻止了我的请求,我如何用javascript提示用户他们的地理位置?(使用) 例如,我的web应用程序需要位置服务,用户不小心单击了“阻止”,或者他们改变了主意。我该怎么做才能再次提示他们?您不能 用户必须手动管理其浏览器设置,因为当位置权限被拒绝时,您的网站将被添加到黑名单中 以下是Chrome用户管理其位置权限的说明:如@matthew shwery所述,您不能更改权限。 您最好检查权限,并通知用户权限被拒绝 navigator.permissions.query({

如果用户在过去阻止了我的请求,我如何用javascript提示用户他们的地理位置?(使用)

例如,我的web应用程序需要位置服务,用户不小心单击了“阻止”,或者他们改变了主意。我该怎么做才能再次提示他们?

您不能

用户必须手动管理其浏览器设置,因为当位置权限被拒绝时,您的网站将被添加到黑名单中


以下是Chrome用户管理其位置权限的说明:

如@matthew shwery所述,您不能更改权限。
您最好检查权限,并通知用户权限被拒绝

navigator.permissions.query({
     name: 'geolocation'
 }).then(function(result) {
     if (result.state == 'granted') {
         report(result.state);
         geoBtn.style.display = 'none';
     } else if (result.state == 'prompt') {
         report(result.state);
         geoBtn.style.display = 'none';

         navigator.geolocation.getCurrentPosition(revealPosition, positionDenied, geoSettings);
     } else if (result.state == 'denied') {
         report(result.state);
         geoBtn.style.display = 'inline';
     }
     result.onchange = function() {
         report(result.state);
     }
 });

在Chrome上可能存在重复的,您可以将其指向其设置页面:
chrome://settings/content/location
。我试过了,可以使用window.open('chrome://settings/content/location"),给出错误->不允许加载本地资源:chrome://settings/content/locationOn 在Chrome浏览器上,您可以将他们引导到他们的设置页面:
chrome://settings/content/location
。你是怎么做到的@ToolmakerSteve@FernandoTorres-我给出的是一个URL。你如何处理它取决于你的情况。你可以把它放在网页的链接中,其中包含一些文本,解释此链接是什么,以及到达该链接后要做什么。