2

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

This website does not have permission to use the Geolocation API

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.

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

  • Do we need some browser settings to use this API?
  • What persmission do we require for our website, to use the geolocation API?

Code:

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");
    }

}

In case of success:

function geolocationSuccess(position) {

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



}

In case of error:

function geolocationError(positionError) {

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


}
Yaqub Ahmad
  • 27,569
  • 23
  • 102
  • 149

4 Answers4

7

This could be a Windows setting, at least it was in my case. Try going to Settings (search from the Start menu in Windows) > Privacy > Location and turn Location = On.

brjali
  • 71
  • 1
  • 4
1

Follow the instructions below for IE:

  • Open Tools>> Internet Options >> see below image

enter image description here

Yaqub Ahmad
  • 27,569
  • 23
  • 102
  • 149
  • It doesnt help. I have this in console.log `PositionError {}code: 1message: "User denied Geolocation"__proto__: PositionError HTMLPage1.html:88 This website does not have permission to use the Geolocation API` – NoWar Aug 04 '15 at 00:25
0

For Windows 10 you may need to turn on "Location service" in Settings > Privacy > Location before you turn it on in Internet Explorer.

See: Windows 10 location service and privacy

BillVo
  • 565
  • 1
  • 5
  • 20
-1

Do note that if you get this problem in windows phone while developing mobile apps, the website should be something like: "http://www.geo.com/geo". If the domain is a certain ip address, say: "192.168.1.2", ie "http://192.168.1.2/geo", you can never get through it!

bush
  • 1