I have written the following code to access my location, but this code is not showing my current location.
What are the changes that I need to make. Because I am a beginner and I don't know much.
Thank you in advance.
<body>
<a href="#" id="get_location">Get location</a>
<div id="map">
<iframe id="google_map" width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.co.in?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.co.in/?q=' + coords + '&z=60&output=embed');
}
document.getElementById('get_loaction').onclick = function()
{
navigator.geolocation.getCurrentPosition(c);
return false;
}
</script>
</body>