I am trying to use this code(below) it is working fine on Microsoft edge but not on chrome, how to I get it to work on chrome?
$(document).ready(function() {
$("button").click(function() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
}
function showPosition(position) {
$("p").append("Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude);
}
});
});
In chrome it even prompts to allow the location but it doesn't show the coordinates.
Thanks