JavaScript Geolocation

published about 8 months, 3 weeks ago, by Joel Watts #

I spent my afternoon playing around with the new geolocation API in Mobile Safari that shipped with the latest iPhone OS update. And since coordinates aren’t very interesting without a map put them on, I invited version 3 of the Google Maps API to come along for the ride.

Demo

You’ll need a brower that supports the W3C Geolocation API to run the demo. If you’re on an iPhone, support is included in version 3.0 of the iPhone operating system.

Access to Core Location—the gatekeeper to the GPS—has long been the single strongest pull, for me, towards native iPhone programming. Being about to get at a user’s location from JavaScript means I can cross off a whole section from my “things to learn” list… for now.