O'Reilly logo

Programming the Mobile Web by Maximiliano Firtman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Detecting the Location

Let’s take a look at some samples of the different techniques, and a multiplatform solution that will work for almost all devices. Table 11-1 analyzes browser compatibility with the different client techniques.

Table 11-1. Client geolocation API support list

Browser/platform

Client geolocation support

Safari

W3C Geolocation API from iOS 3.0

Android browser

Gears from Android 1.5

W3C Geolocation API from Android 2.0

Symbian/S60

No support (available in widgets)

Nokia Series 40

No support

webOS

No support (available in offline applications)

BlackBerry

BlackBerry Location since 4.1

Gears since 5.0

W3C Geolocation API announced from 6.0

NetFront

No support

Openwave (Myriad)

No support

Internet Explorer

No support (Gears optionally, if it’s installed)

Motorola Internet Browser

No support

Opera Mobile

No support (Gears optionally, if it’s installed)

Opera Mini

No support

W3C Geolocation API

The World Wide Web Consortium is working on a standard way to query the user’s position from JavaScript, called the Geolocation API. The API is still in draft at the time of this writing, but the draft status has not stopped some providers from using it: it has been implemented in Firefox since version 3.5, in mobile Safari since iOS version 3.0, and in the Android browser since 2.0. We should expect it to be implemented in more browsers in the future.

The Geolocation API doesn’t rely on one location technology. Instead, it allows the browser to decide which method it will use.

With this API implemented in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required