Chrome已阻止我的地理位置跟踪

时间:2017-09-22 10:20:15

标签: javascript html5 google-chrome geolocation

我正在开发一个使用" geolocation"为此我需要允许一天多次访问和拒绝访问,只是为了看看它如何与我的代码一起工作。这只是一个代码示例。

<script>
    if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(showPosition);
/*        navigator.geolocation.getCurrentPosition(showPosition, showError);*/
    } else { 
        alert("Geolocation is not supported by this browser.")
    }
</script>

突然间它总是拒绝跟踪我的位置,当我点击跟踪图标时它会显示

"The following sites have been blocked from tracking your location on this page <my page name>" 

低于它说

"Settings will be cleared on next reload"

我已尝试重新加载页面,我已尝试重新启动Google Chrome,我已进入位置设置,但阻止列表为空,因此无法找到我的那里的页面。

那我该怎么办?只要我的页面被永久封锁,我就无法继续开发我的页面。

3 个答案:

答案 0 :(得分:1)

TL; DR:设置>清除浏览数据>高级>选中“托管的应用程序数据”>清除数据

演练:

  1. 在Chrome中,单击菜单按钮,然后单击“设置”(或直接访问“ chrome:// settings /”)。
  2. 在“设置”中,开始在搜索栏中输入“清除浏览数据”,然后在“隐私和安全性”下选择“清除浏览数据”。
  3. 在“清除浏览数据”弹出窗口中,单击“高级”选项卡。
  4. 将时间范围设置为“过去一小时”(或更长时间,具体取决于您认为Chrome开始阻止地理位置的时间)。
  5. 选中“托管应用数据”复选框(应位于列表底部),然后取消选择所有其他复选框。
  6. 点击“清除数据”。
  7. 返回正在尝试请求地理位置的页面。下次您尝试触发地理定位权限对话框时,该对话框将出现。

更多说明:

对于开发工作,您可以在Chrome DevTools中覆盖地理位置。有关说明,请参见以下文章:https://developers.google.com/web/tools/chrome-devtools/device-mode/geolocation

答案 1 :(得分:0)

尝试使用Microsoft Edge而不是Google Chrome,我仅使用Microsoft Edge来测试本地主机上当前浏览器的位置

答案 2 :(得分:0)

public static class DependencyInjectionConfiguration
    {
        public static void ConfigureDI(IServiceCollection services)
        {
            services.AddScoped<IReceiver, Receiver>();
            services.AddHttpClient<MyClient>();
            services.AddScoped<HelperXml>();
            //services.AddSingleton<ILoggerFactory, LoggerFactory>();
            //services.AddSingleton(typeof(ILogger<>), typeof(Logger<>));
            //services.AddLogging(configure => configure.AddConsole());
        }
    }