Skip to content

Instantly share code, notes, and snippets.

@rioleo
Created October 27, 2011 18:43
Show Gist options
  • Save rioleo/1320432 to your computer and use it in GitHub Desktop.
Save rioleo/1320432 to your computer and use it in GitHub Desktop.
Simple Geolocation Alert
<script>
function success(position) {
alert(position.coords.latitude);
alert(position.coords.longitude);
}
function error(msg) {
alert("Could not find your location");
}
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success, error);
} else {
error('not supported');
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment