[whatwg] Geolocation in the browser
Kornel Lesinski
kornel at osiolki.net
Thu Feb 22 14:59:37 PST 2007
On Wed, 21 Feb 2007 20:31:11 -0000, Ryan Sarver
<rsarver at skyhookwireless.com> wrote:
> var location = window.getLocation();
For some applications location given in format other than lat/long may be
more useful and less privacy-sensitive.
For example name of the city might be good enough if you order a cab from
a nationwide company.
Postcode would be easiest way to integrate location API with existing
services (especially via userjs/greasemonkey, where using
location->postcode database may be difficult).
Additionally city/postcode information may be provided to desktop browsers
by the user (for example Opera collects that information already).
Also different applications may be satisfied with different precision of
location (searching for nearest airport vs nearest starbucks :)
There's also privacy problem with giving too precise location and
usability problem with asking for user's permission every time.
My proposal is:
use navigator.getGeolocation instead of window.getLocation to avoid
conflicts with existing functions (window object is a global namespace in
JS) and to avoid confusion with window.location object.
navigator.getGeolocation() would return location with best precision
allowed by default (without asking user every time). If user set in
preferences that every page can get location with 10km precision, that
would be returned.
navigator.getGeolocation(100) would request location that has precision of
100m or better. If user's default allowed precision is lower than the
specified one, browser would ask for permission. Browser would be allowed
to return location with lower precision than requested (if it doesn't have
information precise enough or because user decided so).
The function would return an object, which could be queried about various
aspects of the location - name of the city, postcode, but also precision
of location given (so applications would know if user is really exactly in
the middle of the city or if browser only knows the city name).
--
regards, Kornel Lesiński
More information about the whatwg
mailing list