Open Location in Map

Example opening location in Google Maps.

Preview

Code

<button onclick="openMap()">Open Map</button>

<script>
function openMap(){
 navigator.geolocation.getCurrentPosition(function(pos){
  var url="https://www.google.com/maps?q="+
  pos.coords.latitude+","+pos.coords.longitude;
  window.open(url);
 });
}
</script>

More HTML Geolocation Examples (4)