W3C Geolocation API
Encyclopedia
The W3C Geolocation API is an effort by the World Wide Web Consortium
(W3C) to standardize an interface to retrieve the geographical location information for a client-side device. It defines a set of objects, ECMAScript
standard compliant, that executing in the client application give the client's device location through the consulting of Location Information Server
s, which are transparent for the application programming interface
(API). The most common sources of location information are IP address
, Wi-Fi
and Bluetooth
MAC address
, radio-frequency identification (RFID), Wi-Fi connection location, or device Global Positioning System
(GPS) and GSM/CDMA
cell IDs. The location is returned with a given accuracy depending on the best location information source available.
The Geolocation API is ideally suited to web applications for mobile devices such as personal digital assistant
s (PDA) and smartphone
s. However, there is not yet widespread support on such platforms due to the wide variety of devices and mobile browsers, which usually lack a plugin architecture. On desktop computers, the W3C Geolocation API works in Firefox since version 3.5, Google Chrome
, Opera
10.6, Internet Explorer
9.0, and Safari 5. On mobile devices, it works on Android (firmware 2.0 +), iOS, Windows Phone
and Maemo
. The W3C Geolocation API is also supported by Opera Mobile 10.1 — available for Android and Symbian
devices (S60 generations 3 & 5) since November 24, 2010.
Google Gears provides geolocation support for older and non-compliant browsers, including Internet Explorer 7.0+ as a Gears plugin, and Google Chrome which implements Gears natively. It also supports geolocation on mobile devices as a plugin for the Android browser (pre version 2.0) and Opera Mobile
for Windows Mobile
. The Google Gears Geolocation API is incompatible with the W3C Geolocation API.
Google Gears Geolocation works by sending a set of parameters that could give a hint as to where the user's physical location is to a network location provider server, which is by default the one provided by Google (code.l.google.com). Some of the parameters are lists of sensed mobile cell towers and Wi-Fi networks, all with sensed signal strengths. These parameters are encapsulated into a JavaScript Object Notation (JSON
) message and sent to the network location provider via HTTP POST. Based on these parameters, the network location provider can calculate the location. Common uses for this location information include enforcing access controls, localizing and customizing content, analyzing traffic, contextual advertising
and preventing identity theft.
code that checks if the browser has the Geolocation API implemented or it has Google Gears to create the geolocation object and then uses it to get the current position of the device.
World Wide Web Consortium
The World Wide Web Consortium is the main international standards organization for the World Wide Web .Founded and headed by Tim Berners-Lee, the consortium is made up of member organizations which maintain full-time staff for the purpose of working together in the development of standards for the...
(W3C) to standardize an interface to retrieve the geographical location information for a client-side device. It defines a set of objects, ECMAScript
ECMAScript
ECMAScript is the scripting language standardized by Ecma International in the ECMA-262 specification and ISO/IEC 16262. The language is widely used for client-side scripting on the web, in the form of several well-known dialects such as JavaScript, JScript, and ActionScript.- History :JavaScript...
standard compliant, that executing in the client application give the client's device location through the consulting of Location Information Server
Location Information Server
The Location Information Server, or LIS is a network node originally defined in the National Emergency Number Association i2 network architecture that addresses the intermediate solution for providing e911 service for users of VoIP telephony...
s, which are transparent for the application programming interface
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...
(API). The most common sources of location information are IP address
IP address
An Internet Protocol address is a numerical label assigned to each device participating in a computer network that uses the Internet Protocol for communication. An IP address serves two principal functions: host or network interface identification and location addressing...
, Wi-Fi
Wi-Fi
Wi-Fi or Wifi, is a mechanism for wirelessly connecting electronic devices. A device enabled with Wi-Fi, such as a personal computer, video game console, smartphone, or digital audio player, can connect to the Internet via a wireless network access point. An access point has a range of about 20...
and Bluetooth
Bluetooth
Bluetooth is a proprietary open wireless technology standard for exchanging data over short distances from fixed and mobile devices, creating personal area networks with high levels of security...
MAC address
MAC address
A Media Access Control address is a unique identifier assigned to network interfaces for communications on the physical network segment. MAC addresses are used for numerous network technologies and most IEEE 802 network technologies, including Ethernet...
, radio-frequency identification (RFID), Wi-Fi connection location, or device Global Positioning System
Global Positioning System
The Global Positioning System is a space-based global navigation satellite system that provides location and time information in all weather, anywhere on or near the Earth, where there is an unobstructed line of sight to four or more GPS satellites...
(GPS) and GSM/CDMA
CDMA2000
CDMA2000 is a family of 3G mobile technology standards, which use CDMA channel access, to send voice, data, and signaling data between mobile phones and cell sites. The set of standards includes: CDMA2000 1X, CDMA2000 EV-DO Rev. 0, CDMA2000 EV-DO Rev. A, and CDMA2000 EV-DO Rev. B...
cell IDs. The location is returned with a given accuracy depending on the best location information source available.
Deployment in web browsers
Web pages can use the Geolocation API in two ways: directly, if the web browser implements it or through the Google Gears plugin.The Geolocation API is ideally suited to web applications for mobile devices such as personal digital assistant
Personal digital assistant
A personal digital assistant , also known as a palmtop computer, or personal data assistant, is a mobile device that functions as a personal information manager. Current PDAs often have the ability to connect to the Internet...
s (PDA) and smartphone
Smartphone
A smartphone is a high-end mobile phone built on a mobile computing platform, with more advanced computing ability and connectivity than a contemporary feature phone. The first smartphones were devices that mainly combined the functions of a personal digital assistant and a mobile phone or camera...
s. However, there is not yet widespread support on such platforms due to the wide variety of devices and mobile browsers, which usually lack a plugin architecture. On desktop computers, the W3C Geolocation API works in Firefox since version 3.5, Google Chrome
Google Chrome
Google Chrome is a web browser developed by Google that uses the WebKit layout engine. It was first released as a beta version for Microsoft Windows on September 2, 2008, and the public stable release was on December 11, 2008. The name is derived from the graphical user interface frame, or...
, Opera
Opera (web browser)
Opera is a web browser and Internet suite developed by Opera Software with over 200 million users worldwide. The browser handles common Internet-related tasks such as displaying web sites, sending and receiving e-mail messages, managing contacts, chatting on IRC, downloading files via BitTorrent,...
10.6, Internet Explorer
Internet Explorer
Windows Internet Explorer is a series of graphical web browsers developed by Microsoft and included as part of the Microsoft Windows line of operating systems, starting in 1995. It was first released as part of the add-on package Plus! for Windows 95 that year...
9.0, and Safari 5. On mobile devices, it works on Android (firmware 2.0 +), iOS, Windows Phone
Windows Phone
Windows Phone is a mobile operating system developed by Microsoft, and is the successor to its Windows Mobile platform, although incompatible with it. Unlike its predecessor, it is primarily aimed at the consumer market rather than the enterprise market...
and Maemo
Maemo
Maemo is a software platform developed by the Maemo community for smartphones and Internet tablets. It is based on the Debian Linux distribution, but has no relation to it...
. The W3C Geolocation API is also supported by Opera Mobile 10.1 — available for Android and Symbian
Symbian
Symbian is a mobile operating system and computing platform designed for smartphones and currently maintained by Accenture. The Symbian platform is the successor to Symbian OS and Nokia Series 60; unlike Symbian OS, which needed an additional user interface system, Symbian includes a user...
devices (S60 generations 3 & 5) since November 24, 2010.
Google Gears provides geolocation support for older and non-compliant browsers, including Internet Explorer 7.0+ as a Gears plugin, and Google Chrome which implements Gears natively. It also supports geolocation on mobile devices as a plugin for the Android browser (pre version 2.0) and Opera Mobile
Opera Mobile
Opera Mobile is a web browser for smartphones and PDA's developed by the Opera Software company. The first version was released in 2000 for the Psion Series 7 and netBook. Today, it is available for a variety of devices that run on Android, S60, Windows Mobile, Maemo , and MeeGo...
for Windows Mobile
Windows Mobile
Windows Mobile is a mobile operating system developed by Microsoft that was used in smartphones and Pocket PCs, but by 2011 was rarely supplied on new phones. The last version is "Windows Mobile 6.5.5"; it is superseded by Windows Phone, which does not run Windows Mobile software.Windows Mobile is...
. The Google Gears Geolocation API is incompatible with the W3C Geolocation API.
Implementation
Though the implementation is not specified, W3C Geolocation API is built on extant technologies, and is heavily influenced by Google Gears Geolocation API. Example: Firefox's Geolocation implementation uses Google's network location provider.Google Gears Geolocation works by sending a set of parameters that could give a hint as to where the user's physical location is to a network location provider server, which is by default the one provided by Google (code.l.google.com). Some of the parameters are lists of sensed mobile cell towers and Wi-Fi networks, all with sensed signal strengths. These parameters are encapsulated into a JavaScript Object Notation (JSON
JSON
JSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...
) message and sent to the network location provider via HTTP POST. Based on these parameters, the network location provider can calculate the location. Common uses for this location information include enforcing access controls, localizing and customizing content, analyzing traffic, contextual advertising
Contextual advertising
Contextual advertising is a form of targeted advertising for advertisements appearing on websites or other media, such as content displayed in mobile browsers...
and preventing identity theft.
Example code
Simple JavaScriptJavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
code that checks if the browser has the Geolocation API implemented or it has Google Gears to create the geolocation object and then uses it to get the current position of the device.
External links
- Firefox 3.5 Geolocation Features for developing location applications
- Tutorial and example of Geolocation API with Google Gears
- Add a network location provider to Gears
- WebScanNotes.com - W3C Geolocation API