I'm having trouble retrieving the user's geolocation on the site. Localhost works, but no network. I'm finding that the problem is that it does not have SSL certificate and the site is accessed by HTTP and not HTTPS.
See the error:
getCurrentPosition () and watchPosition () are deprecated on insecure origins. To use this feature, you should consider switching your application to secure origin, such as HTTPS . See link for more details.
My code:
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(pos){
var lat = pos.coords.latitude;
var lng = pos.coords.longitude;
console.log(lat + ' - ' + lng);
}
}
And Safari does not work. Can not retrieve geolocation from Localhost. In other browsers it works normally in Localhost.