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:
I'm only familiar with my own device, so this is my list so far:
?
What is the level of support in Blackberry, Android phones, etc?
The Navigator. geolocation read-only property returns a Geolocation object that gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location.
Most modern web browsers support browser geolocation, but only in a secure context (HTTPS). Some older browsers may not support browser geolocation. It is advised to always check in your code whether browser geolocation is supported before attempting to use the functionality, as shown in this javascript example.
The Geolocation API is accessed via a call to navigator. geolocation ; this will cause the user's browser to ask them for permission to access their location data. If they accept, then the browser will use the best available functionality on the device to access this information (for example, GPS).
If you allow Google Chrome to share your location with a site, the browser will send local network information to Google Location Services to get an estimate of your location. The browser can then share your location with the requesting site.
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:
There are at least two mobile browsers that implement the Geolocation API:
On all of these platforms, you should be able to use navigator.geolocation.getCurrentPosition, etc.
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.
navigator.geolocation
with very similar syntax.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/"
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.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With