Mobile Line Of Business

Richard Jones (MVP)

  Home  |   Contact  |   Syndication    |   Login
  202 Posts | 0 Stories | 36 Comments | 0 Trackbacks


Welcome to the Mobile Line Of Business Blog

Tag Cloud

Article Categories


Image Galleries


Both Mobile Safari (in iPhone OS 3.0) and Google Android now both support getting the location of the current user.

How cool is that.   Finally mobile web-pages can be location aware.    The user is prompted for whether they wish to enable this facility on a per site basis.

Here’s the HTML/Javascript that does it all.







navigator.geolocation.getCurrentPosition(foundLocation, noLocation);

function foundLocation(position)
  var lat = position.coords.latitude;
  var long = position.coords.longitude;
alert('Found location: ' + lat + ', ' + long);

function noLocation()
  alert('Could not find location');



<h1>Location App</h1>

In the above example  when the location is found it displays current location.
I’ve posted a slightly more feature rich version at
posted on Friday, June 19, 2009 7:22 AM