• <legend id='XAxQ3'><style id='XAxQ3'><dir id='XAxQ3'><q id='XAxQ3'></q></dir></style></legend>

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

    1. <small id='XAxQ3'></small><noframes id='XAxQ3'>

          <bdo id='XAxQ3'></bdo><ul id='XAxQ3'></ul>

        地理位置 getCurrentPosition() 和 watchPosition() 不适用于不安全的来源

        Geo location getCurrentPosition() and watchPosition() not work on insecure origins(地理位置 getCurrentPosition() 和 watchPosition() 不适用于不安全的来源)
        <legend id='jyhtn'><style id='jyhtn'><dir id='jyhtn'><q id='jyhtn'></q></dir></style></legend>
                <bdo id='jyhtn'></bdo><ul id='jyhtn'></ul>
              • <small id='jyhtn'></small><noframes id='jyhtn'>

                <tfoot id='jyhtn'></tfoot>

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

                  本文介绍了地理位置 getCurrentPosition() 和 watchPosition() 不适用于不安全的来源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要使用 php 的用户的纬度和经度.试试下面的代码.

                  I need user's Lattitude and longitude using php. try following code.

                  <!DOCTYPE html>
                  <html lang="en">
                  <head>
                  <meta charset="UTF-8">
                  <title>Example of HTML5 Geolocation</title>
                  <script type="text/javascript">
                      function showPosition(){
                          if(navigator.geolocation){
                              navigator.geolocation.getCurrentPosition(function(position){
                                  var positionInfo = "Your current position is (" + "Latitude: " + position.coords.latitude + ", " + "Longitude: " + position.coords.longitude + ")";
                                  document.getElementById("result").innerHTML = positionInfo;
                              });
                          } else{
                              alert("Sorry, your browser does not support HTML5 geolocation.");
                          }
                      }
                  </script>
                  </head>
                  <body>
                      <div id="result">
                          <!--Position information will be inserted here-->
                      </div>
                      <button type="button" onclick="showPosition();">Show Position</button>
                  </body>
                  </html>                            

                  但是当我在服务器中运行这段代码时,我在获取用户纬度和经度时发现了这个警告错误.

                  but when i run this code in server i found this warning error when i fetch User Lattitude and Longitude.

                  getCurrentPosition() 和 watchPosition() 不再适用于不安全起源.要使用此功能,您应该考虑切换您的应用到安全源,例如 HTTPS

                  getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS

                  虽然 同样的代码在这里工作..else 建议获取用户纬度和经度的任何其他代码.谢谢.

                  while Same code works here..else suggest any other code to get user Latitude and longitude. thanks.

                  推荐答案

                  Geolocation API 从 Chrome 50 中的 Unsecured Origins 中移除.

                  Geolocation API Removed from Unsecured Origins in Chrome 50.

                  此更改自 Chrome 50(太平洋标准时间 2016 年 4 月 20 日中午 12 点)起生效.

                  This change is effective as of Chrome 50 (12PM PST April 20 2016).

                  Chrome 的开发者工具控制台自 44 版(2015 年 7 月 21 日发布)以来一直提供警告.有许多公开声明描述了我们进行此更改的理由(和讨论):

                  Chrome's developer tools console has been providing warnings since version 44 (released July 21 2015). There have been a number of public announcements that describe the rationale (and discussion) of why we are making this change:

                  打算弃用 HTTP 上的一组强大功能(2015 年 2 月)打算弃用基于 HTTP 的 Geolocation API(2015 年 11 月)Chrome 开发者峰会(2016 年 11 月)Chrome Beta 频道发布博客(2016 年 3 月 17 日)Chrome 状态网站还有许多其他来源强调了这一点:Mobiforge(2016 年 1 月 26 日)、Wired(2016 年 3 月 17 日)、VentureBeat(2016 年 4 月 13 日).

                  Intent to deprecate set of powerful features over HTTP (Feb 2015) Intent to deprecate Geolocation API over HTTP (Nov 2015) Chrome Dev Summit (Nov 2016) Chrome Beta Channel release blog (March 17, 2016) Chrome Status website There have been a number of other sources that have highlighted this: Mobiforge (Jan 26, 2016), Wired (March 17, 2016), VentureBeat (April 13, 2016).

                  在这里阅读更多文档 .所以没有 HTTPS 就无法使用 GeoLocation.

                  Read More Documentatin here .So thats not possible to use GeoLocation Without HTTPS.

                  这篇关于地理位置 getCurrentPosition() 和 watchPosition() 不适用于不安全的来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  • <small id='yXMNG'></small><noframes id='yXMNG'>

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

                            <tbody id='yXMNG'></tbody>
                            <legend id='yXMNG'><style id='yXMNG'><dir id='yXMNG'><q id='yXMNG'></q></dir></style></legend><tfoot id='yXMNG'></tfoot>