HTML5 地理位置如何工作?

How does HTML5 Geolocation Work?(HTML5 地理位置如何工作?)

本文介绍了HTML5 地理位置如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Chrome 和 Firefox 已实现 HTML 地理位置.

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 ?

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

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 正在使用 Google WebService 来检测位置.现在考虑到他们现在是竞争对手,这似乎很奇怪.而且这种行为对我来说真的很出乎意料...我希望每个浏览器都会开启(可能是离线)解决方案.

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.

更新 3:所以浏览器实际上会嗅探使用您的无线网卡的路由器吗?

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

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

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 ?

关于可能实现这一点的其他浏览器.他们应该怎么做?该 api 没有记录,只有旧的不推荐使用的 GEAR api 提供了一些线索.所以这并不是真正公开的.

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.

推荐答案

就其价值而言,API 规范本身与地理位置实现无关.因此,虽然 Mozilla Firefox 和 Google Chrome 确实都依赖于通过 Google 的位置服务数据库启用网络的地理定位,但这并不是标准的要求.例如,在某些情况下,iPhone 上的 Mobile Safari 将使用 GPS,而不是 WiFi 三角测量或蜂窝站点地理定位,具体取决于在给定时刻最准确和可访问的定位服务.

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.

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

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.

这篇关于HTML5 地理位置如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:HTML5 地理位置如何工作?

基础教程推荐