Someone with geolocation problem does not work Google Chrome.
It works normally in other browsers, chrome does not work, follow the link below.
Someone with geolocation problem does not work Google Chrome.
It works normally in other browsers, chrome does not work, follow the link below.
As the log informs:
[Deprecation] getCurrentPosition () and watchPosition () no longer work on insecure origins. To use this feature, you should consider switching your application to a secure source, such as HTTPS. (anonymous) @ index.php: 80
In other words, getCurrentPosition
and watchPosition
can not be used if your page is not in HTTPS, this has probably been disabled in HTTP to prevent midpoint traps from getting user location data.
More details at: link
However if you want to get the current latitude and longitude ( does not have accuracy guaranteed) you can use something like this answer in SOen , in JavaScript would look something like:
getGEO(function (lat, long) {
//Aqui você pode setar a latitude e longitude no seu mapa
console.log(lat, long);
}, function(msg, details) {
console.log("Erro", msg, details);
});
function getGEO(done, fail){
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://ipinfo.io/geo", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
var err;
if (xhr.status >= 200 && xhr.status < 300) {
try {
alert(1);
var parsed = JSON.parse(xhr.responseText);
var ll = parsed.loc.split(",");
done(ll[0], ll[1]);
} catch (ee) {
fail('Parse error', ee);
}
} else {
fail('Request error', xhr.status);
}
}
};
xhr.send(null);
}