Created
September 2, 2017 18:29
-
-
Save jerryasher/cf1b47cbfadc3ac0077bc5e2b3ca0b21 to your computer and use it in GitHub Desktop.
mapit.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: Mapit | |
Date: 2017-09-02 | |
Tags: spa | |
stuff | |
<h1>Finding Me</h1> | |
<button onclick="getLocation3()">Where am I?</button> | |
<p id="location3"></p> | |
more stuff | |
<script> | |
function getLocation3() | |
{ | |
// Check whether browser supports Geolocation API or not | |
if (navigator.geolocation) { // Supported | |
// To add PositionOptions | |
navigator.geolocation.getCurrentPosition(getPosition3); | |
} else { // Not supported | |
alert("Oops! This browser does not support HTML Geolocation."); | |
} | |
} | |
function getPosition3(position) | |
{ | |
document.getElementById("location3").innerHTML = | |
"Latitude: " + position.coords.latitude + "<br>" + | |
"Longitude: " + position.coords.longitude; | |
} | |
// To add catchError(positionError) function | |
</script> | |
final stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment