HTML5 地理定位如何工作?

发布于 2024-10-03 19:31:23 字数 617 浏览 3 评论 0原文

Chrome 和 Firefox 已实现 HTML 地理定位。

我的问题是:它是如何运作的?他们在本地是否有数据库并从提供商处获取信息然后尝试匹配它?

DB存储在哪里? 可以访问吗?

Update1:​​地理定位的唯一缺点是浏览器必须征求用户的许可,这对于可用性来说确实是一件坏事。我了解安全问题,但仍然不知道这将如何成为流行的解决方案。

Update2:Firefox 正在使用 Google WebService 来检测位置。考虑到他们现在是竞争对手,这看起来很奇怪。而且这种行为对我来说真的是出乎意料的......我希望每个浏览器都会有它的开启(可能是离线)解决方案。

Update3:那么浏览器实际上是使用您的无线网卡来嗅探路由器的?

Update4:浏览器到底向google webservice发送什么信息?检测到的 SSID 似乎没问题(如果谷歌根据他们的物理位置跟踪他们以在数据库中查找匹配信息,这是有道理的)但是它如何在谷歌没有扫描的国家/地区工作得这么好?您的浏览器发送的其他信息是您的 IP,但这不足以确定您的确切位置,对吗?

关于可能实现此功能的其他浏览器。他们应该怎样做呢?该 api 没有记录,只有旧的已弃用的 GEAR api 提供了一些线索。所以这并不是真正公开的。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

遗弃M 2024-10-10 19:31:23

首先,一个令人惊叹的演示

在 Chrome 中尝试这个

工作原理

这里就是您的答案。点击“Google Chrome 如何确定您的位置”。

从该页面:

如果您允许 Google Chrome 与网站共享您的位置,浏览器会将本地网络信息发送到 Google 定位服务,以估计您的位置。然后,浏览器可以与请求站点共享您的位置。 Google 定位服务用于估计您位置的本地网络信息包括有关可见 WiFi 接入点的信息,包括其信号强度;有关您本地路由器的信息;您计算机的 IP 地址。 Google 定位服务的准确性和覆盖范围会因位置而异。

Chrome 浏览器会保存您的位置信息,以便轻松检索。该信息会定期更新;更新频率取决于您本地网络信息的更改。

另外,我相信 Google 定位服务包含一个由 Google 街景货车收集的数据构建的数据库,因为它们将位置与来自路由器的 WiFi 信号相匹配(或至少 曾经)。

访问数据库

至于数据库(Google 定位服务),这个 SO问题将帮助您访问它。

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.

深海蓝天 2024-10-10 19:31:23

无论如何,API 规范本身与地理位置实现无关。因此,虽然 Mozilla Firefox 和 Google Chrome 确实都依赖于通过 Google 位置服务数据库进行网络支持的地理定位,但这并不是标准的要求。例如,iPhone 上的 Mobile Safari 在某些情况下将使用 GPS,而不是 WiFi 三角测量或蜂窝基站地理定位,具体取决于在给定时刻哪种定位服务最准确且最容易访问。

我们希望未来的浏览器能够提供一些位置提供商的选择。我同意,如果浏览器支持不需要向第三方发送 WiFi ID 列表的地理定位技术,这对用户隐私和功能都有好处;我怀疑,随着 GPS 传感器越来越多地集成到智能手机和笔记本电脑中,我们将看到允许您将 GPS 传感用于 W3C 地理定位 API 的浏览器。如果桌面计算机有一个功能,可以在浏览器设置中手动指定位置,这也可能会很好,这也与当前规范兼容。

For what it's worth, the API specification itself is agnostic to the geolocation implementation. So while it's true that Mozilla Firefox and Google Chrome both rely on network-enabled geolocation via Google's Location Service database, that's not a requirement of the standard. For example, Mobile Safari on your iPhone will in some cases use GPS rather than WiFi-triangulation or cell-site geolocation, depending on what location service is most accurate and accessible at a given moment.

And we can hope that future browsers will provide some choice of the location provider. I agree that it would be good for user privacy and functionality if browsers supported geolocation technologies that didn't require sending a list of WiFi IDs to a third party; I suspect that as GPS sensors are more often integrated into smartphones and laptops, we'll see browsers that let you use GPS sensing for the W3C Geolocation API. It might also be nice to have a feature for desktop computers where the location can be manually specified in browser settings, this would also be compatible with the current spec.

鸠魁 2024-10-10 19:31:23

在 Firefox 中打开一个新选项卡并输入地址 about:config。跳过警告消息并在过滤框中输入 geo.wifi.uri,您现在正在查看 Firefox 用于确定您位置的网络服务。

In Firefox open a new tab and type in the address about:config. Go past the warning message and type geo.wifi.uri into the filter box, you are now looking at the web service Firefox uses for determining your location.

倒数 2024-10-10 19:31:23

来自 Firefox 的“它是如何工作的”

当您访问位置感知网站时,Firefox 会询问您是否要共享您的位置。
如果您同意,Firefox 会收集有关附近无线接入点和您计算机的 IP 地址的信息。然后,Firefox 将此信息发送到默认的地理定位服务提供商 Google 定位服务,以估计您的位置。然后,该位置估计会与请求网站共享。
如果您表示不同意,Firefox 将不会执行任何操作。

以及“Chrome 如何确定您的位置” :

如果您允许 Google Chrome 与网站共享您的位置,浏览器会将本地网络信息发送到 Google 定位服务,以估计您的位置。然后,浏览器可以与请求站点共享您的位置。在与网站共享您的位置之前,您应该检查网站的隐私政策。

From Firefox's "How does it work":

When you visit a location-aware website, Firefox will ask you if you want to share your location.
If you consent, Firefox gathers information about nearby wireless access points and your computer’s IP address. Then Firefox sends this information to the default geolocation service provider, Google Location Services, to get an estimate of your location. That location estimate is then shared with the requesting website.
If you say that you do not consent, Firefox will not do anything.

and from "How Chrome determines your location":

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. You should examine a website's privacy policy before sharing your location with them.

樱娆 2024-10-10 19:31:23

我对 update4 中最后一个问题的猜测是,他们会根据您使用的设备不时更新您的位置。例如,如果您仅使用 PC 访问网络,并且附近没有已知的 wifi 网络,那么您的位置将由 IP 地址确定,但是有关您的网络的信息将被收集,稍后假设您将 iPhone 或任何其他设备连接到GPS 到您同一个 wifi 网络,并在其上使用 GPS,谷歌会将这些 GPS 坐标与您的 wifi SSID 或 IP 地址相匹配。因此,此后,每当您的 PC 上的浏览​​器发送地理定位请求时,它都会检查 IP 和 SSID 是否匹配(也许还有其他一些东西,例如附近的 SSID 等),如果匹配,它将返回之前由您配备 GPS 的设备确定的位置。当然,这只是一个猜测,但也可能是这样..而且,即使您从未将任何配备 GPS 的设备连接到您的网络,但它仍然可以准确地确定它,这可能是因为附近的 wifi 网络,谷歌已经知道了..他们所做的工作确实很棒:)

更新:

       火狐浏览器

       谷歌浏览器

My guess to the last question in update4 is that supposedly they are updating your location from time to time, based on what device you use. For example if you used only your PC to access the web, and there is no known wifi networks nearby then your location will be determined by IP address, however information about your network will be gathered, later say you connect iPhone or any other device with GPS to your same wifi network, and use GPS on it, google will match those GPS coordinates to your wifi SSID or IP address. So, after then whenever your browser on PC sends a request for geolocation, it will check if the IP and SSID match (and maybe bunch of other things too, like SSID's in neighborhood and so on), and if they match, it will return the location that was previously determined by your GPS equipped device. This is just a guess of course, but it could be so.. also, even if you have never connected any GPS equipped device to your network, but it still determines it accurately, that might be because of the wifi networks in neighborhood, that are already known by google.. that's an awesome work they do, for sure :)

Update:

       Firefox

       Google Chrome

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文