Google chrome geolocation not working

11,452

Solution 1

Latest chrome has deprecated this API on non-secure origins:

https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins

Time to get https://localhost up and running ;)

For future queries... https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only?hl=en

Solution 2

This appears to be fixed now. Must have been an issue due to a server-side change google made. When I was debugging I was seeing a rate limit issue, even when I ran the getCurrentPosition() call in console on https://www.google.com.

Share:
11,452
Bilal Akmal
Author by

Bilal Akmal

Updated on June 04, 2022

Comments

  • Bilal Akmal
    Bilal Akmal almost 2 years

    I'm working on cross platform application. navigator.geolocation was working fine, but since last 2 days it just giving problem in Google chrome. Is the api deprecated or some other issue for this api? I tested following code on many different browsers and network but still the same issue.

    var options = {
      enableHighAccuracy: true,
      timeout: 5000,
      maximumAge: 0
    };
    
    function success(pos) {
      var crd = pos.coords;
    
      console.log('Your current position is:');
      console.log('Latitude : ' + crd.latitude);
      console.log('Longitude: ' + crd.longitude);
      console.log('More or less ' + crd.accuracy + ' meters.');
    };
    
    function error(err) {
      console.warn('ERROR(' + err.code + '): ' + err.message);
    };
    
    navigator.geolocation.getCurrentPosition(success, error, options);
    

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

  • Ido.Co
    Ido.Co over 8 years
    I don't think so this, this also fails for me on localhost which is defined as a secured domain.