Created
September 2, 2017 18:29
-
-
Save jerryasher/b5864ec282fffc6b4f03e303d86b8820 to your computer and use it in GitHub Desktop.
mapbetter.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title: MapBetter | |
Date: 2017-09-01 | |
Tags: spa | |
stuff | |
<h1>Finding Me</h1> | |
<button onclick="getLocation2()">Where am I?</button> | |
<p id="location2"></p> | |
more stuff | |
<script> | |
function getLocation2() | |
{ | |
// but this does not work | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(getPosition2); | |
} else { | |
// what breaks | |
alert("Oops! This browser does not support HTML Geolocation."); | |
} | |
} | |
function getPosition2(position) | |
{ | |
document.getElementById("location2").innerHTML = "Latitude: " + position.coords.latitude + "<br>" + "Longitude: " + position.coords.longitude; | |
} | |
</script> | |
final stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment