• <bdo id='4SiWA'></bdo><ul id='4SiWA'></ul>
  • <i id='4SiWA'><tr id='4SiWA'><dt id='4SiWA'><q id='4SiWA'><span id='4SiWA'><b id='4SiWA'><form id='4SiWA'><ins id='4SiWA'></ins><ul id='4SiWA'></ul><sub id='4SiWA'></sub></form><legend id='4SiWA'></legend><bdo id='4SiWA'><pre id='4SiWA'><center id='4SiWA'></center></pre></bdo></b><th id='4SiWA'></th></span></q></dt></tr></i><div id='4SiWA'><tfoot id='4SiWA'></tfoot><dl id='4SiWA'><fieldset id='4SiWA'></fieldset></dl></div>
      <legend id='4SiWA'><style id='4SiWA'><dir id='4SiWA'><q id='4SiWA'></q></dir></style></legend>
      1. <tfoot id='4SiWA'></tfoot>

        <small id='4SiWA'></small><noframes id='4SiWA'>

      2. 关于 HTML 5 中的地理位置

        时间:2023-09-06

        • <legend id='54ODu'><style id='54ODu'><dir id='54ODu'><q id='54ODu'></q></dir></style></legend>

            <small id='54ODu'></small><noframes id='54ODu'>

              <bdo id='54ODu'></bdo><ul id='54ODu'></ul>
            • <tfoot id='54ODu'></tfoot>
                <tbody id='54ODu'></tbody>

                  <i id='54ODu'><tr id='54ODu'><dt id='54ODu'><q id='54ODu'><span id='54ODu'><b id='54ODu'><form id='54ODu'><ins id='54ODu'></ins><ul id='54ODu'></ul><sub id='54ODu'></sub></form><legend id='54ODu'></legend><bdo id='54ODu'><pre id='54ODu'><center id='54ODu'></center></pre></bdo></b><th id='54ODu'></th></span></q></dt></tr></i><div id='54ODu'><tfoot id='54ODu'></tfoot><dl id='54ODu'><fieldset id='54ODu'></fieldset></dl></div>
                  本文介绍了关于 HTML 5 中的地理位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  Google 地图现在可以在 Firefox 的帮助下精确定位我的街道位置.

                  Google Maps can now pinpoint my location with street precision with the help of Firefox.

                  我了解这是兼容 HTML 5 的浏览器的一项新功能,并且该位置是通过使用连接的 WiFi 网络的某种功能获取的(我希望我没有做出任何愚蠢的假设).

                  I understand this is a new feature of HTML 5 compatible browsers and that the location is fetched by using some sort of feature of the connected WiFi network (I hope I'm not making any silly assumptions).

                  我想知道的是整个过程是如何运作的:

                  What I intend to know is how this whole process exactly works:

                  • 为什么只在 HTML 5 中?
                  • Firefox 为什么/如何要求我与 Google 地图分享我的位置?
                  • 可以指望的正常精度是多少?
                  • 如何在我的网站中实现此功能?

                  提前致谢!

                  推荐答案

                  它是如何工作的?

                  当您在 Firefox 中访问位置感知网站时,浏览器会询问您是否要共享您的位置.

                  When you visit a location-aware website in Firefox, the browser will ask you if you want to share your location.

                  如果您同意,Firefox 会收集有关附近无线接入点和您计算机的 IP 地址的信息,并将通过将此信息发送到 Google 位置服务(Firefox 中的默认地理位置服务).然后与请求的网站共享该位置估计.(来源)

                  If you consent, Firefox gathers information about nearby wireless access points and your computer’s IP address, and will get an estimate of your location by sending this information to Google Location Services (the default geolocation service in Firefox). That location estimate is then shared with the requesting website. (Source)

                  位置的准确性如何?

                  准确性因地点而异.在某些地方,地理定位服务提供商可能能够提供几米以内的位置.然而,在其他领域,它可能远不止于此.由于无法保证所提供位置的准确性,所有位置均被视为估计值.(来源)

                  Accuracy varies greatly from location to location. In some places, the geolocation service providers may be able to provide a location to within a few meters. However, in other areas it might be much more than that. All locations are to be considered estimates as there is no guarantee on the accuracy of the locations provided. (Source)

                  就我而言,Firefox 报告说我离我的真实位置大约 10 公里.

                  In my case, Firefox reports that I am about 10km away from my real location.

                  如何在我的网站中使用此功能?

                  你会这样做:

                  if (navigator.geolocation) { 
                      navigator.geolocation.getCurrentPosition(function(position) {  
                  
                          alert(position.coords.latitude + ", " + position.coords.longitude);
                  
                          // Use the latitude and location as you wish. You may set a marker
                          // on Google Maps, for example.
                      }); 
                  } 
                  else {
                      alert("Geolocation services are not supported by your browser.");
                  }  
                  

                  您可以在此处查看在线演示:Firefox HTML 5 地理位置演示(需要地理位置 -可识别浏览器,例如 Firefox 3.1b3.)

                  You can see an online demo here: Firefox HTML 5 Geolocation Demo (Requires a geolocation-aware browser such as Firefox 3.1b3.)

                  这篇关于关于 HTML 5 中的地理位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:(英国)裁剪地图上 x 和 y 的墨卡托经度和纬度计算 下一篇:哪些设备支持通过 navigator.geolocation 进行 Javascr

                  相关文章

                  最新文章

                  1. <legend id='wIzmZ'><style id='wIzmZ'><dir id='wIzmZ'><q id='wIzmZ'></q></dir></style></legend><tfoot id='wIzmZ'></tfoot>

                    • <bdo id='wIzmZ'></bdo><ul id='wIzmZ'></ul>
                  2. <small id='wIzmZ'></small><noframes id='wIzmZ'>

                    1. <i id='wIzmZ'><tr id='wIzmZ'><dt id='wIzmZ'><q id='wIzmZ'><span id='wIzmZ'><b id='wIzmZ'><form id='wIzmZ'><ins id='wIzmZ'></ins><ul id='wIzmZ'></ul><sub id='wIzmZ'></sub></form><legend id='wIzmZ'></legend><bdo id='wIzmZ'><pre id='wIzmZ'><center id='wIzmZ'></center></pre></bdo></b><th id='wIzmZ'></th></span></q></dt></tr></i><div id='wIzmZ'><tfoot id='wIzmZ'></tfoot><dl id='wIzmZ'><fieldset id='wIzmZ'></fieldset></dl></div>