Skip to content

Instantly share code, notes, and snippets.

@galfert
Created September 7, 2013 14:44
Show Gist options
  • Save galfert/6476165 to your computer and use it in GitHub Desktop.
Save galfert/6476165 to your computer and use it in GitHub Desktop.
Geolocation
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(
function(position) {
console.log(position.coords.latitude, position.coords.longitude);
},
function(error) {
alert(error.message);
}, {
enableHighAccuracy: true,
timeout: 5000
}
);
} else {
/* geolocation IS NOT available */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment