Skip to content

Instantly share code, notes, and snippets.

@matthewbauer
Created April 11, 2010 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewbauer/362904 to your computer and use it in GitHub Desktop.
Save matthewbauer/362904 to your computer and use it in GitHub Desktop.
// Geolocation support for Uzbl
navigator.geolocation = {};
navigator.geolocation.getCurrentPosition = function(success, error){
if ( Uzbl.run("sh 'zenity --question --text \'This website, " + location.href + ", wants to access your location. Do you want me to give it to them?\'; echo $?'") == '0' ){
success(Uzbl.run("sh 'geoiplookup $(curl -s icanhazip.com) | sed -rn \'s/GeoIP City Edition, Rev 1: [^,]*, [^,]*, [^,]*, [^,]*, ([^,]*), ([^,]*), [^,]*, [^,]*/\1 \2/p\''"));
} else {
error();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment