Notice: Undefined index: title in /var/www/lukemorton.co.uk/public/html5/includes/header.php on line 6 Call Stack: 0.0004 233464 1. {main}() /var/www/lukemorton.co.uk/public/html5/geolocation.php:0 0.0005 239072 2. require_once('/var/www/lukemorton.co.uk/public/html5/includes/header.php') /var/www/lukemorton.co.uk/public/html5/geolocation.php:56 HTML5 Notice: Undefined index: css in /var/www/lukemorton.co.uk/public/html5/includes/header.php on line 26 Call Stack: 0.0004 233464 1. {main}() /var/www/lukemorton.co.uk/public/html5/geolocation.php:0 0.0005 239072 2. require_once('/var/www/lukemorton.co.uk/public/html5/includes/header.php') /var/www/lukemorton.co.uk/public/html5/geolocation.php:56

GeoLocation

Forget what letters I capitalised, this is awesome. In fact forget capitalism, but that is another thought for now have a look at this GeoLocation example.

Although I am using navigator.geolocation, I am using somewhat of a shiv hosted on Google Code here. It uses native geolocator API (part of the HTML5 spec) if available then falling back to other API's where necessary. It has little or no support in many browsers, but does work fairly successfully in Firefox, Chrome, Safari, and Safari for the iPhone.

The usage

Please find an example of my fantasy uLocation web app below, all it is is Google Map, using GeoLocation to pinpoint your location on the map, you will need to accept your browsers security warning if you wish to see you location on the map. View source for a sneak peak.

Please wait whilst we obtain your location, you may need to give permission.

As you may find out, the accuracy is subject to how you get your connection, for example on a supported mobile phone, your position can be triangulated using your nearest cells, same with WiFi connections, however if you are using a standard ADSL connection or something alike, the only location method maybe IP address, which isn't the most accurate of methods.