Skip to content

Instantly share code, notes, and snippets.

@duksis
Created May 29, 2012 11:21
Show Gist options
  • Save duksis/2827907 to your computer and use it in GitHub Desktop.
Save duksis/2827907 to your computer and use it in GitHub Desktop.
Script to get location information from browser
//
// Script for getting location data from browser
//
navigator.geolocation.getCurrentPosition(getLocation, unknownLocation);
function getLocation(pos) {
var latitde = pos.coords.latitude;
var longitude = pos.coords.longitude;
alert('Your current coordinates (latitide,longitude) are : ' + latitde + ', ' + longitude);
}
function unknownLocation() {
alert('Could not find location');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment