25

The iPhone supports geolocation in mobile Safari via the following call:

navigator.geolocation.getCurrentPosition(
  function(pos){
    var lat = pos.coords.latitude;
    var long = pos.coords.longitude;
  },
  function(){
    /* Handler if location could not be found */
  }
);

I'd like to build a good list of devices that have one of the following:

  1. support this feature out of the box, or
  2. support this feature with an upgrade, or
  3. support geolocation with equivalent fidelity of data with some other snippet of Javascript.

I'm only familiar with my own device, so this is my list so far:

Out of the box:

  1. iPhone 3GS

Supported, but only with an update

  1. iPhone 3G
  2. iPhone 2G (?)
  3. PC or Mac computer with Firefox 3.5

Supported with some other snippet

?

What is the level of support in Blackberry, Android phones, etc?

Maciek
  • 3,192
  • 6
  • 25
  • 35
  • Many devices support access to GPS location, just not necessarily through `navigator.geolocation`. You really only care about that particular API? – Crescent Fresh Aug 28 '09 at 20:19
  • Well, anything through Javascript should technically do fine, as long as you can do feature detection (are we in the same boat as XHR already?) – Maciek Aug 28 '09 at 21:49

7 Answers7

17

As of today, the W3C Geolocation API (widely associated with, though not technically part of, HTML 5) is support in the following major desktop browsers:

  • Firefox (since 3.5)
  • Safari (since 5.0)
  • Google Chrome (version depends on OS)
  • Opera (since 10.60)
  • Internet Explorer (since IE 9)

There are at least two mobile browsers that implement the Geolocation API:

  • Safari Mobile (since iPhone OS 3.0)
  • Android (since at least Android 1.6)

On all of these platforms, you should be able to use navigator.geolocation.getCurrentPosition, etc.

Matthew Lock
  • 11,495
  • 11
  • 84
  • 122
user251563
  • 171
  • 1
  • 2
7

Although I think it's a great practice to standardize on the (draft, by the way) W3C Geolocation API, it's worth noting that there are a few other options in the browser, which can be particularly helpful if you need to target an older platform.

  • Firefox 3.1 had support for Geode, which uses calls to navigator.geolocation with very similar syntax.
  • Loki is a plug-in built by Skyhook which works on Internet Explorer 6, Internet Explorer 7, Firefox 2, Firefox 3, Safari and Opera. The syntax is substantially different, but still easy.
  • Google Gears provides a geolocation API with a syntax fairly similar to the W3C API syntax. You can install Google Gears on Internet Explorer 6+, Firefox 1.5+, Safari, Opera Mobile and IE Mobile.
npdoty
  • 4,498
  • 22
  • 24
4

From a similar more recent topic:

"I'm working on an open source library that supports all javascript location capable phones with the W3C standard. So far it supports iPhone, Android, BlackBerry and some fringe browser platforms running in a browser. The lib can also be used when writing web stack standalone apps for Nokia OVI and the Palm WebOS.

http://code.google.com/p/geo-location-javascript/"

Stan Wiechers
  • 1,751
  • 21
  • 40
3

The W3C version works on android 2.*. On android 1.6 you can fallback to gears, which will work pretty much the same way. In theory the W3C standard should also work on Firefox mobile (Fennec), which currently is available for Nokia's Maemo devices and will be standard on MeeGo.

  • actually I wrote a blog post on this with a few more details, at: http://textopiablog.wordpress.com/2010/05/07/cross-platform-locative-media/ I'm no expert on this myself, but there are links to some more info there for anyone interested. – Anders Sundnes Løvlie Jun 16 '10 at 22:36
1

You don’t have to have the newest mobile phone to use GPS and Geolocation API. Almost every mobile browser (without proxy server) can be used to read position from buidin GPS. If You have Java and GPS in Your phone – You can use mobile-gps-web-gate – see at http://code.google.com/p/mobile-gps-web-gate/

krycek
  • 19
  • 1
0

I know this is an old question, but you'll find a list of devices that support geolocation here: http://www.quirksmode.org/webkit.html. This list is being maintained by the site author so it should stay up to date.

Kevin
  • 11,181
  • 22
  • 78
  • 97
0

Franson's GPSGate is a commercial product that can expose a Windows machine's hardware GPS to any browser through javascript. The interface is a little different from the W3C's implementation though.

Update: the Express (lite) version of GPSGate is free.

Matthew Lock
  • 11,495
  • 11
  • 84
  • 122
  • 1
    +1 for GPSGate which we found was the only solution for Windows 7 Desktop as no browser provides the hardware GPS location to the Geolocation object. There was a move to include support in Chrome but this was removed again, [Issue 45535](https://code.google.com/p/chromium/issues/detail?id=45535) – kes Feb 04 '15 at 12:16