Created
September 2, 2017 18:30
-
-
Save jerryasher/f6c3ec82fc505621b864c857f8f4cd3f to your computer and use it in GitHub Desktop.
map.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: Map | |
Date: 2017-08-31 | |
Tags: spa | |
stuff | |
<h1>Finding Me</h1> | |
<button onclick="getLocation()">Where am I?</button> | |
<p id="location"></p> | |
more stuff | |
<script> | |
function getLocation() | |
{ | |
// this works | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(getPosition); | |
} else { | |
// what breaks | |
alert("Oops! This browser does not support HTML Geolocation."); | |
} | |
} | |
function getPosition(position) | |
{ | |
document.getElementById("location").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