Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome navigator.geolocation.getCurrentPosition() error 403

For some reason suddenly when calling navigator.geolocation.getCurrentPosition() I get this error:

Network location provider at 'https://www.googleapis.com/' : Returned error code 403.

It used to work perfectly yesterday! Could there be anything with their servers??

like image 769
mllm Avatar asked Sep 01 '15 10:09

mllm


People also ask

Why is geolocation not working?

If you are facing problems with geolocation on your website running our WordPress Directory theme using Google Chrome browser, it's because of Google's decision to allow geolocation functionality only for websites that use SSL certificates.

What does geolocation getCurrentPosition return?

Geolocation getCurrentPosition() Method The getCurrentPosition() method returns the current position of the device.

Which choice is the mandatory parameter of the getCurrentPosition () method?

Which choice is the mandatory parameter of the getCurrentPosition () method? Explanation: Coordinates of object is return by getCurrentPosition() method. getCurrentPosition() function accepts three parameters i.e. success, position and error. When data is fetched successfully success callback will be invoked.

What is the significance of the first parameter in getCurrentPosition () API?

The error callback function, if provided when calling getCurrentPosition() or watchPosition() , expects a GeolocationPositionError object instance as its first parameter.


2 Answers

It appears it is back up now. But before I realized it was working, I used another way to get location data as recommended by another user on reddit.com

var latLong; $.getJSON("http://ipinfo.io", function(ipinfo){     console.log("Found location ["+ipinfo.loc+"] by ipinfo.io");     latLong = ipinfo.loc.split(","); }); 

Source: https://www.reddit.com/r/webdev/comments/3j8ipj/anyone_else_had_issues_with_the_html5_geolocation/

like image 181
Amin Avatar answered Sep 30 '22 06:09

Amin


This happens for me too on idoco.github.io/map-chat

I suspect that this is related the the changes google planed for Deprecating Powerful Features on Insecure Origins it seems that some changes were done in the last few days in this chromium Issue 520765: Deprecation and removal of powerful features on insecure origins

Can you test your site over https to confirm that?

In the meanwhile I found this api usage as a workaround on this repo:

  $.getJSON("http://ipinfo.io", function(doc){     var latlong = doc.loc.split(",")     setUserLocation(parseFloat(latlong[0]), parseFloat(latlong[1]));     getLocation(parseFloat(latlong[0]), parseFloat(latlong[1])).then(function(res){       userLocationName = res     })     initialiseEventBus();     map.panTo(userLocation);    }, function(err) {     setUserLocation(Math.random()*50, Math.random()*60);     userLocationName = "unknown.na"     initialiseEventBus();     map.panTo(userLocation);   }) 
like image 40
Ido.Co Avatar answered Sep 30 '22 07:09

Ido.Co