Skip to content

Instantly share code, notes, and snippets.

@dmshvetsov
Created September 1, 2013 03:04
Show Gist options
  • Save dmshvetsov/6402079 to your computer and use it in GitHub Desktop.
Save dmshvetsov/6402079 to your computer and use it in GitHub Desktop.
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
//code for displaying results
//document.getElementById('show-lat-lon').innerHTML='<p>' + latitude + ' ' + longitude + '</p>';
});
} else {
alert("Geolocation API is not supported in your browser.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment