diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


Google ClientLocation Ajax API, Geolocation module for Gears API

Google has released two new APIs for you to grab the user’s location information via JavaScript. The simple way is to derive location information from the IP. It’s ClientLocation property of their Ajax API that includes “metro-level granularity properties”. All you need is a free API key, and then you can load their JavaScript file in your HTML and access the: country, region, city, low resolution latitude and longitude. This could be useful if you want to customize a web page for a specific country or to prefill information about location. You probably noticed that google.com automatically redirects to the appropriate international domain and that when you create a Google account your country is already selected.

Google has also released a Geolocation module for their Gears API. Google says that “the Geolocation module provides the best estimate of the user’s position using a number of sources (called location providers). These providers may be onboard (GPS for example) or server-based (a network location provider).” The API includes a method that lets you track the changes and perform an action based on the new location. Unlike the AJAX API, this requires that users have Gears 0.4 installed and they explicitly allow the application to obtain location information. Unfortunately, Gears is only available for Firefox, IE and IE Mobile, but the team promises to extend the availability to other browsers. Gears for Safari will soon be released, so S60 and iPhone support shouldn’t be far away. Google Mobile Blog has two examples of sites that already use the Gears API.

Share This Story, Choose Your Platform!

Do NOT follow this link or you will be banned from the site!