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.
Latest chrome has deprecated this API on non-secure 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