HTML5 的 GeoLocation 究竟是如何工作的?

2023-04-20前端开发问题
7

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

问题描述

我知道浏览器会共享我的 IP 地址和附近无线网络的详细信息以确定我的位置,但它知道哪些关于附近 wifi 网络的信息?

I know the browser shares my IP address and details of nearby wireless networks to determine my location, but what sort of info does it know about nearby wifi networks?

例如,我住的地方没有公共无线网络,从我家我可以看到大约 5 个专用网络,但我的位置被确定在 20 米之内.由于附近没有开放网络,Google 如何确定我的位置?我能想到的唯一方法是,Google 在为街景地图绘制街道时,会绘制所有无线网络的位置.

For example, where I live are no public wireless networks, and from my home I can see about 5 private networks, yet my location is determined within 20 meters. With there being no open networks nearby, how does Google determine my location? The only way I can think of is that Google mapped the locations of all wireless networks when they mapped streets for Street View.

我在网上搜索过,但都找不到任何具体的细节.

I've searched about online, but all I can't find any specific details.

推荐答案

Firefox 发送给 Google 的数据适用于所有可见的访问点,无论是公共的还是私有的.对于检测到的每个接入点,它会将以下数据发送到 https://www.google.com/loc/json:

The data sent by Firefox to Google is for all visible access points, public or private. For each access point detected, it sends the following data to https://www.google.com/loc/json:

  "mac_address": "01-23-45-67-89-ab",
  "signal_strength": 8,
  "age": 0,
  "SSID": "MyAccessPoint"

在哪里

  • mac_address是WiFi节点的mac地址.
  • signal_strength 是以 dBm 为单位测量的当前信号强度.
  • age 是自检测到 WiFi 节点以来的毫秒数.
  • SSID 是名称或 ESSID.

用于对您的请求进行地理编码的地理参考 WiFi 数据是 谷歌开车时为街景拍照时收集的.

The georeferenced WiFi data used to geocode your request was collected when Google was driving around taking pictures for StreetView.

需要注意的是,这就是 HTML5 地理定位 API 在 Firefox 上使用 Google 的地理定位服务实现的方式.这是一种实现,而不是规范.如果您的设备具有内置 GPS,则可能希望您的 HTML5 实现直接查询 GPS,而不是使用地理定位服务.

It is important to note that, however, that this is how the HTML5 geolocation API is implmeneted on Firefox using Google's Geolocation Services. This is an implementation, not a specification. If your device has a built-in GPS, it is probably desirable that your HTML5 implementation queries the GPS directly, rather than using a geolocation service.

即使是 firefox 在 Windows 和 Linux 上实现此功能的方式也不同.在 Windows 上使用当前的 Firefox,所有可见 WiFi 节点的详细信息都将发送给 Google.由于 在 Linux 上使用当前的 Firefox,仅发送当前连接的 WiFi 节点的详细信息依赖 libiw 获取访问点数据.

Even firefox implements this feature differently on Windows and Linux. Using a current Firefox on Windows, details of all visible WiFi nodes are sent to Google. Using a current Firefox on Linux, only details of the currently connected WiFi node is sent, due to the reliance on libiw for access point data.

正如另一位回答者指出的那样,Safari 使用 Skyhook Wireless 的服务,其功能与 Google 的 Location 大致相同服务.

As another answerer noted, Safari uses Skyhook Wireless's service which does much the same thing as Google's Location Services.

这篇关于HTML5 的 GeoLocation 究竟是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

ajax请求获取json数据并处理的实例代码
ajax请求获取json数据并处理的实例代码 $.ajax({ type: 'GET', url: 'https://localhost:44369/UserInfo/EditUserJson',//请求数据 data: json,//传递数据 //dataType:'json/text',//预计服务器返回的类型 timeout: 3000,//请求超时的时间 //回调函数传参 suc...
2024-11-22 前端开发问题
215

layui 实现实时刷新一个外部的div
主页面上显示了一个合计,在删除和增加的时候需要更改这个总套数的值: //html代码div class="layui-inline layui-show-xs-block" style="margin-left: 10px" id="sumDiv"spanSOP合计:/spanspan${totalNum}/spanspan套/span/div 于是在我们删除这个条数据后,...
2024-11-14 前端开发问题
156

layui laydate日期时间范围,时间默认设定为23:59:59
在Layui中,如果你想设置日期时间选择器(datetime)的默认结束时间为当天的23:59:59,你可以使用如下代码: laydate.render({ elem: '#test10' ,type: 'datetime' ,range: true ,max: '{:date("Y-m-d 23:59:59")}' ,ready: function(date){ $(".layui-laydat...
2024-10-24 前端开发问题
279

layui要如何改变时间日历布局大小?
问题描述 我想改变layui时间日历布局大小,这个要怎么操作呢? 解决办法 可以用css样式对时间日历进行重新布局,具体代码如下: !DOCTYPE htmlhtmlheadmeta charset="UTF-8"title/titlelink rel="stylesheet" href="../../layui/css/layui.css" /style#test-...
2024-10-24 前端开发问题
271

jQuery怎么动态向页面添加代码?
append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href...
2024-10-18 前端开发问题
125

JavaScript(js)文件字符串中丢失"\"斜线的解决方法
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转...
2024-10-17 前端开发问题
437