In new chrome (44.0.2403.157) geolocations doesnt works

后端 未结 5 1207
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: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");
        }
    

提交回复
热议问题