HTML5 Geolocation Demo
I’ve been fooling around with the new HTML5 geolocation API and i’ve put together a small demo page for learning purposes. Well, technically speaking the geolocation API isn’t really part of HTML5 i think, as it’s defined by a separate working group, but most browsers will implement this alongside HTML5 so it probably makes sense to lump them together. The demo is basically the equivalent of “hello world” for geolocation apps: it will map your current location using Google Maps.
Using the geolocation API is surprisingly simple, it took me about 4 hours to put the demo page together, with limited Javascript programming experience and no prior experience with the geolocation API, the Google Maps API and jQuery (lots of learning opportunities here). I had not done a lot of web front end development with Javascript before (mostly just HTML and CSS) and it was surprising how much you can do on the client side (and how easily). The demo page is pure HTML + CSS + Javascript, with no serverside processing whatsoever. This means that the whole source code of the demo page is just a “view source” away. This also means that no location information whatsoever is sent to engadgeted.net when you click that button on the demo page. Your location is (obviously) sent to Google Maps, but since Firefox asks Google Location Services about your location in the first place anyway, i suppose that doesn’t really make a huge difference.
Would you like to comment or share this post?
Tell me what you think on Twitter: Tweet