I started an app to get my location when I click on a button, but my problem is that my browser and other browsers don't permit me to use my location.
I already tried different browsers like Chrome, Edge, Mozilla and none of them gave me permission.
It always says that it is "blocked to protect my privacy"
Here's my code, because I don't know if it has something to do with it:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Geolocation</title>
</head>
<body>
<a href="#" id="get_location">Get Localtion</a>
<div id="map">
<iframe id="google_map" width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?output=embed"></iframe>
</div>
<script>
var c = function(pos) {
var lat = pos.coords.latitude,
long = pos.coords.longitude,
coords = lat + "," + long;
document.getElementById("google_map").setAttribute("src","https://maps.google.com/maps?q=" + coords + "&z=60&output=embed");
}
document.getElementById("get_location").onclick = function(){
navigator.geolocation.getCurrentPosition(c);
return false;
}
</script>
</body>
</html>
And here's the "error":
