HTML5 地理定位功能如何工作?
浏览器如何知道我在哪里?
完全基于注册的IP地址?如果我在代理后面怎么办?
How can the browser tell where I am?
Totally based on registered IP address? What if I'm behind a proxy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这取决于浏览器及其设置。它可能使用 GPS、基于 WLAN AP 的定位、IP 定位或任何其他可以想象的自身定位方法。
浏览器在您的本地计算机上运行,因此即使您位于代理后面,它也应该能够找到您的实际 IP 地址(除非安全功能阻止将其发送到地理定位服务器进行查找)。我不知道是否有浏览器足够智能来处理 NAT 后面的情况(本地计算机具有私有 IP)并查找网关的 IP 地址。
That would depend on the browser and its settings. It might use GPS, WLAN AP-based location, IP location, or any other conceivable method of locating itself.
The browser runs on your local machine, so even if you're behind a proxy, it should be able to find your actual IP address (unless security features prevent it from being sent for lookup to a geolocation server). Whether any browser is smart enough to handle being behind a NAT (with the local machine having a private IP) and looking up the gateway's IP address, that I don't know.
正如 Matti 所说,它是特定于浏览器的。以下是有关 Firefox 如何执行此操作的信息:http://www.mozilla.com/en-美国/火狐/地理定位/
As Matti said, it is browser-specific. Here's information on how Firefox does it: http://www.mozilla.com/en-US/firefox/geolocation/
例如,Firefox 和 Fennec 使用 Google 定位服务,Google Gears 也使用该服务。
Firefox and Fennec for instance use the Google Location Service, which is also used by Google Gears.
如果您同意,Firefox 会收集有关附近无线接入点和您计算机的 IP 地址的信息。然后,Firefox 将此信息发送到默认的地理定位服务提供商 Google 定位服务,以估计您的位置。然后,该位置估计会与请求网站共享。
mozilla
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.
mozilla