In new chrome (44.0.2403.157) geolocations doesnt works

后端 未结 5 1206
Happy的楠姐
Happy的楠姐 2020-12-10 05:53

Its seems like in new chrome version on MacOs on Linux Mint and on Windows geolocations doesnt works! Its returns error: \"ERROR(2): Network location provider at \'https://

相关标签:
5条回答
  • 2020-12-10 06:19

    For future queries:

    Starting with Chrome 50, Chrome no longer supports obtaining the user’s location using the HTML5 Geolocation API from pages delivered by non-secure connections. This means that the page that’s making the Geolocation API call must be served from a secure context such as HTTPS.

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

    This will break your web apps on chrome if you're not using HTTPS.

    0 讨论(0)
  • 2020-12-10 06:29

    Apparently this API has been forbidden access from insecure locations see here

    0 讨论(0)
  • 2020-12-10 06:33

    Must be a bug in the latest version of Chrome, also happens in the page of Google Maps API: https://developers.google.com/maps/documentation/javascript/examples/map-geolocation

    Hopefully it will be fixed fast.

    Edited: Try now, it works :)

    0 讨论(0)
  • 2020-12-10 06:34

    i didn't get any solution for "Returned error code 403" but i found one solution to get current location if google api fails

     if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function (position) {
                current_location_lat = position.coords.latitude;
                current_location_lon = position.coords.longitude;
               }, function (error) {
    //if error occurred by google api
                  $.getJSON("http://ipinfo.io", function (ipinfo) {
                    var latLong = ipinfo.loc.split(",");
                    current_location_lat = latLong[0];
                    current_location_lon = latLong[1];
                     });
                });
    
        } else {
            // Browser doesn't support Geolocation
            alert("Error: Your browser doesn\'t support geolocation");
        }
    
    0 讨论(0)
  • 2020-12-10 06:36

    I filed a bug ticket here: https://productforums.google.com/forum/?utm_medium=email&utm_source=footer#!msg/chrome/q7B6gjCr1ps/Y9DEXPZ-_HYJ

    Feel free to comment there, star it, etc.

    0 讨论(0)
提交回复
热议问题