-4
Someone with geolocation problem does not work Google Chrome.
Works normally in other browsers, Chrome does not work, follow the link below.
-4
Someone with geolocation problem does not work Google Chrome.
Works normally in other browsers, Chrome does not work, follow the link below.
1
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 origin, such as HTTPS. (Anonymous) @index.php:80
That is to say getCurrentPosition
and watchPosition
cannot be used if your page is not in HTTPS, this has probably been inactivated in HTTP to prevent mid-way interceptions from retrieving user location data.
More details on: https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins
However if you want to catch the current latitude and longitude (has not guaranteed accuracy) can use something like this reply on 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);
}
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.