Skip to content

Instantly share code, notes, and snippets.

@pavenuto
Created October 4, 2010 17:14
Show Gist options
  • Save pavenuto/610078 to your computer and use it in GitHub Desktop.
Save pavenuto/610078 to your computer and use it in GitHub Desktop.
function geoLocate()
{
navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
}
function foundLocation(position)
{
var lat = position.coords.latitude;
var long = position.coords.longitude;
window.location="/locations/geo/" + lat + "," + long;
}
function noLocation()
{
alert('Could not find location');
}
$(document).ready(function() {
geoLocate();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment