Created
September 7, 2013 14:44
-
-
Save galfert/6476165 to your computer and use it in GitHub Desktop.
Geolocation
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
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