Hello, Everybody!
I am working on the “Show the Local Weather” project but I got stuck at the very beginning as it seems my getCurrentPosition()
does not trigger the callback function. Here is my code (view on codepen):
if(navigator.geolocation) {
console.log("navigator.geolocation is available");
navigator.geolocation.getCurrentPosition(function(position) {
console.log("current position acquired");
});
}
When I run it, in the console I can see the first message (“navigator.geolocation is available”) but not the second (“current position acquired”). I have already checked that my browser settings allow access to my location, therefore I have no idea about what the problem could be; any suggestion?
Thanks.