Many modern mobile phones (google nexus one etc.) have some kind of built in location service. when i go to a some website (eg. google.com) that website asks if I'm willing to share my location with that site.
How do you actually ask for mobile device to give out it's location to the site? And in what format is that location given? I've got no clue and didn't find any answers from google, neither.
Web applications on iPhone, Android or even certain desktop browsers (some recent versions of Firefox, Chrome and Opera) use the W3C Geolocation API to request your location. Google Gears also supports a similar geolocation API as a plugin for many browsers, but the W3C API is becoming the standard.
The code to check for support of the API and then request a location is straightforward (if (navigator.geolocation) ...
). Some sample code here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With