Web Browser | Geolocation API support |
Mozilla Firefox | supported in Firefox 3.5 and later versions. |
Chrome | Supports thru Google Gears Geolocation API |
Opera | Supported in nightly builds - download from this page |
Safari | Support is coming soon in the IPhone’s Safari browser. |
Internet Explorer | An experimental support available from IE8. |
There is also one practical trick we've used in some applications (e.g. Geo search) If you are loading Google Ajax API (just a load - do not need to use it :), Google automatically populates a google.loader.ClientLocation object. And you can get from it the geo locations for the user:
<script type="text/javascript" src="http://www.google.com/jsapi?key=your_key"></script>
and some like that in your JavaScript code:
if(google.loader.ClientLocation)
{
lat = google.loader.ClientLocation.latitude;
lng = google.loader.ClientLocation.longitude;
city = google.loader.ClientLocation.address.city;
region = google.loader.ClientLocation.address.region;
country = google.loader.ClientLocation.address.country;
code = google.loader.ClientLocation.address.country_code;
}
No comments:
Post a Comment