Skip to content

Instantly share code, notes, and snippets.

@p5150j
Created August 29, 2011 18:36
Show Gist options
  • Select an option

  • Save p5150j/1179066 to your computer and use it in GitHub Desktop.

Select an option

Save p5150j/1179066 to your computer and use it in GitHub Desktop.
Geo Javascript
<!DOCTYPE html>
<html lang="en">
<head>
<title>Geolocation</title>
</head>
<body>
<script>
function get_location() {
navigator.geolocation.getCurrentPosition(show_map);
};
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
alert('BAM !!! ' + position.coords.latitude + ' / ' + position.coords.longitude);
alert('Ahhh shit...City is: ' + position.address.city + ', ' + position.address.region)
});
}
</script>
<body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment