Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

browser - How does HTML5 Geolocation Work?

Chrome and Firefox have HTML Geolocation implemented.

My question is: how does it work? Do they have a Database locally and get the information from the provider then try to match it?

Where is the DB stored ? Can it be accessed ?

Update1: the only downside to geolocation is the browser has to ask the user for permission and this is really a bad thing for usability. I understand the security issue but still I don't see how this will become a popular solution.

Update2 : Firefox is using a Google WebService to detect the location. Now this seems very strange considering they are competitors now. Also this behavior it's really unexpected for me... I hopped each browser will have it's on (maybe offline) solution.

Update3 : So the browsers actually sniff for routers using your wireless network card?

Update4 : In the end what informations is the browser sending to the the google webservice ? The detected SSID seems ok ( and it makes sense that if they are tracked by google based on their physical position to make a lookup in the database for matching informations ) but how does it work so well in country where google didn't scanned this ? The other info your browser is sending is your ip but this is not enough to pin point your exact location right ?

Regarding other browsers that might implement this. How should they do it ? The api is not documented only the old deprecated GEAR api gives some clue. So this is not really public.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First, an amazing demo

Try this in Chrome.

How it works

Here is your answer. Click on "How Google Chrome determines your location".

From that page:

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. The local network information used by Google Location Services to estimate your location includes information about visible WiFi access points, including their signal strength; information about your local router; your computer's IP address. The accuracy and coverage of Google Location Services will vary by location.

Google Chrome saves your location information so that it can be easily retrieved. This information is periodically updated; the frequency of updates depends on changes to your local network information.

Also, I believe that Google Location Services contains a database built from data collected by Google Street View vans as they match locations with WiFi signals from routers (or at least used to).

Accessing the database

As for the database (Google Location Services), this SO question will help you access it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...