The W3C has created a standard for location sharing called Geolocation. It allows any person to share her location with any website at the click of a button. Imagine the possibilities with this.

Here is a scenario:

You’ve arrived in a new city, a new continent, a new coffee shop. You don’t really know where you are, and are looking for a good place to eat. You pull out your laptop, fire up Firefox, and go to your favorite review site. It automatically deduces your location, and serves up some delicious suggestions a couple blocks away and plots directions there.

Firefox 3.1 will have this build in, but until then we can use a Firefox add-on called Geode. Basically, it uses your Wi-Fi network to find your exact location and then passes it to a JavaScript callback method on your website. Already now, services like Pownce, Fire Eagle and ZYB uses this to improve the user experience of their services.

Here is a screenshot of what it looks like when Geode ask for a location:

Getting started using Geode

You should start by downloading the Geode add-on for Firefox and make sure your Wi-Fi is turned on. Then fire up your HTML editor and add this JavaScript to one of your pages:

function geoNotFound() { alert('You must be on a wifi network for us to determine your location'); }

// Ask the browser for its location geodeAsk();

Open the page in Firefox. Geode will now ask you if you want to share your location with the page. It’s that simple. Geode then sends the latitude and longitude to the JavaScript callback method and you can now do whatever you want with it. If you want to retrieve the address based on the location, then you need to do a simple reverse GEO lookup.