Error: Network Location Provider at "https://www.googleapis.com/": Error Code Returning 400

I get the error 400

whenever I use Visual Studio Code

, but when I use Brackets

it works fine.

What is causing this error and how can I fix it?

Thanks in advance.

 <script>
    var watcher;
    var geoLocator;
    window.onload = function() {
        geoLocator = window.navigator.geolocation;
        var posOptions = {
            enableHighAccuracy: true,
            timeout: 45000
        };
        watcher = geoLocator.watchPosition(successPosition, errorPosition, posOptions);
    }

    function successPosition(pos) {
        var sp = document.createElement("p");
        sp.innerText = "Latitude: " + pos.coords.latitude + " Longitude: " + pos.coords.longitude;
        document.getElementById("geoResults").appendChild(sp);
        geoLocator.clearWatch(watcher);
    }

    function errorPosition(err) {
        var sp = document.createElement("p");
        sp.innerText = "error: " + err.message; + " code:" + err.code;
        document.getElementById("geoResults").appendChild(sp);

    }
</script>

      

+3


source to share


1 answer


I had the same problem. Clear all cache and cookies stored by your browser and try again. This is what worked for me. Once cleaned up, open a new instance of the browser that will be safe.



0


source







All Articles