该网站无权使用Geolocation API [英] This website does not have permission to use the Geolocation API

查看:52
本文介绍了该网站无权使用Geolocation API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试使用地理位置api时遇到此错误:

I am expericing this error, while trying to use the geolocation api:

This website does not have permission to use the Geolocation API

奇怪的是,同一网站在某些系统(安装了 IE.9和I.E10 )上运行良好,并且在 IE 9的系统上引发错误已安装.

The strange thing is that the same website is running fine on one some systems(where IE.9 and I.E10 are installed) and it throws error on a system where I.E 9 is installed.

我们在不同的系统上对其进行了测试,但它仅在安装 I.E9 的特定系统上引发错误.

We tested it on different systems but it throws error only on that particular system where I.E9 is installed.

  • 我们需要一些浏览器设置才能使用此API吗?
  • 使用地理定位API,我们要求网站拥有什么权限?

代码:

function geolocateUser()
{
    // If the browser supports the Geolocation API
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(geolocationSuccess, geolocationError);
    }
    else {
        alert("Your browser doesn't support the Geolocation API");
    }

}

成功的话:

function geolocationSuccess(position) {

    var userCurrentLatLong = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);



}

如果发生错误:

function geolocationError(positionError) {

    alert(positionError.message + "\n" + "you will be redirected to default location.");


}

推荐答案

按照以下有关IE的说明进行操作:

Follow the instructions below for IE:

  • 打开工具>> Internet选项>>参见下图

这篇关于该网站无权使用Geolocation API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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