Navigator.geolocation talk

Hello campers,

I am trying to use this piece of code given to use by FCC in a challenge called ‘Get Geolocation Data’

if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#data").html("latitude: " + position.coords.latitude + "
longitude: " + position.coords.longitude);
});
}

For some reason this does’t work within my pen. Could anyone take a look for me?

Thanks

@ejuor Thank you works fine now.
Where did you see that warning?

When I run this code in my pen without using a http url i get an empty object in my browsers developer console. The console on code pen also doesnt give me this warning