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

        <tfoot id='drIk9'></tfoot>

        <small id='drIk9'></small><noframes id='drIk9'>

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

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

        地理定位在 Windows 7/XP 上的 Safari 5.x 上不起作用

        时间:2023-09-05

          • <bdo id='TrQ3l'></bdo><ul id='TrQ3l'></ul>
            • <small id='TrQ3l'></small><noframes id='TrQ3l'>

                <tfoot id='TrQ3l'></tfoot>
                <legend id='TrQ3l'><style id='TrQ3l'><dir id='TrQ3l'><q id='TrQ3l'></q></dir></style></legend>
                1. <i id='TrQ3l'><tr id='TrQ3l'><dt id='TrQ3l'><q id='TrQ3l'><span id='TrQ3l'><b id='TrQ3l'><form id='TrQ3l'><ins id='TrQ3l'></ins><ul id='TrQ3l'></ul><sub id='TrQ3l'></sub></form><legend id='TrQ3l'></legend><bdo id='TrQ3l'><pre id='TrQ3l'><center id='TrQ3l'></center></pre></bdo></b><th id='TrQ3l'></th></span></q></dt></tr></i><div id='TrQ3l'><tfoot id='TrQ3l'></tfoot><dl id='TrQ3l'><fieldset id='TrQ3l'></fieldset></dl></div>
                    <tbody id='TrQ3l'></tbody>
                  本文介绍了地理定位在 Windows 7/XP 上的 Safari 5.x 上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在开发一个使用 W3C 标准地理定位 API 的应用程序,但我终生无法让它在我的 Windows 7 和 XP PC 上的 Safari 上运行.它在我的 iPad 和 iPhone 上运行良好.它还可以在 Chrome(5、6、7 和 Canary 版本)和 Firefox(3.6)上完美运行.我没有Mac,所以无法对其进行测试.IE 还不支持地理定位,因此也涵盖了这一点.

                  I am working on an app that uses the W3C standard geolocation API but I cannot for the life of me get it to work on Safari on my Windows 7 and XP PC. It works fine on my iPad and my iPhone. It also works perfect on Chrome (5, 6, 7 and the Canary build) and on Firefox (3.6). I don't have a Mac so I can't test it on that. IE doesn't support geolocation yet so that's covered too.

                  我创建了一个精简版并将其托管在 Google Apps Engine 上,因此您可以查看代码:http://html5-geolocator.appspot.com/ .所有(简化的)javascript 都在 html 中,因此您应该能够右键单击并调试/查看源代码.

                  I created a stripped down version and I am hosting it on the Google Apps Engine so you can have a look at the code: http://html5-geolocator.appspot.com/ . All the (simplified) javascript is in the html so you should be able to right-click and debug/view source.

                  这几乎是 Google 上的示例的直接转换地图 API 开发指南.有趣的是,Google 托管的示例也不适用于 Windows 7 上的 Safari 5.0.x(但它们在所有其他平台上都可以正常工作,与我的应用程序相同),例如 http://code.google.com/apis/maps/documentation/javascript/examples/map-geolocation.html 和我的APP一模一样的问题,没有地图,网页一直是灰色的.

                  It is pretty much a straight conversion of the examples on the Google Map API DevGuide. Interestingly enough, the examples that Google is hosting are also NOT WORKING in Safari 5.0.x on Windows 7 (but they work fine on all those other platforms, same as my app), for example http://code.google.com/apis/maps/documentation/javascript/examples/map-geolocation.html exhibits exactly the same issue as my APP, no map appears, the webpage just stays grey.

                  通过一些调试 (alert("I am here") :-) 似乎在 Safari 中,它确实执行了 navigator.geolocation.getCurrentPosition(myCallback),但它似乎永远不会到达 myCallback ...就好像它从来没有从 getCurrentPosition 返回.我还看到,如果我让浏览器窗口在一夜之间打开,当我早上回到它时,警报和地图就会出现(尽管并非总是如此).我还尝试添加了 errorCallback navigator.geolocation.getCurrentPosition(myCallback, errorCallback) 但它也从未执行过,再次表明它永远不会从 getCurrentPosition 调用返回.

                  Through some debugging (alert("I am here") :-) it seems that in Safari, it does execute navigator.geolocation.getCurrentPosition(myCallback), but it never seems to reach myCallback ... as if it never returns from getCurrentPosition. I have also seen that if I leave the browser window open overnight, when I get back to it in the morning the alert and map have appeared (though not always). I also tried added a errorCallback navigator.geolocation.getCurrentPosition(myCallback, errorCallback) but it also never executes that, again suggesting it never returns from the getCurrentPosition call.

                  为什么会这样?

                  只是做了一些更多的测试,我添加了超时选项 (navigator.geolocation.getCurrentPosition(myCallback, errorCallback, {timeout: 5000});) ,事实上它一直超时,不管我设置多高所以它永远不会从 Google 地理定位服务返回,但为什么呢?

                  Just did some more testing, I added the timeout option (navigator.geolocation.getCurrentPosition(myCallback, errorCallback, {timeout: 5000});) , and indeed it it timing out all the time, no matter how high I set it so it is never returning from the Google geolocation service, but why?

                  推荐答案

                  尝试打开你的 wi-fi.看来 Safari 依赖于 wi-fi 连接才能工作.我遇到了完全相同的问题,打开了我的 wi-fi 连接,它运行良好.

                  Try turning on your wi-fi. It appears that Safari relies on the wi-fi connection to work. I was having exactly the same issues, turned my wi-fi connection on and it work perfectly.

                  我现在正在研究如何检测这一点 - 如果我找到解决方案会更新

                  I'm now looking at how to detect this - will update if I find a solution

                  这篇关于地理定位在 Windows 7/XP 上的 Safari 5.x 上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:用户在 javascript 中阻止访问后请求位置坐标 下一篇:通过 Javascript 将 DOMTimeStamp 转换为本地化的 HH:M

                  相关文章

                  最新文章

                    <tfoot id='WZYEr'></tfoot>
                  1. <small id='WZYEr'></small><noframes id='WZYEr'>

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

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