HTML5 地理位置功能如何工作?

2022-01-14 00:00:00 geolocation html

浏览器如何知道我在哪里?

How can the browser tell where I am?

完全基于注册的IP地址?如果我在代理后面怎么办?

Totally based on registered IP address? What if I'm behind a proxy?

推荐答案

这取决于浏览器及其设置.它可能使用 GPS、基于 WLAN AP 的位置、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.

浏览器在您的本地计算机上运行,​​因此即使您使用代理,它也应该能够找到您的实际 IP 地址(除非安全功能阻止将其发送到地理定位服务器以进行查找).是否有任何浏览器足够聪明,可以处理在 NAT 后面(本地机器具有私有 IP)并查找网关的 IP 地址,我不知道.

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.

相关文章