Firefox 地理定位比 iPhone Safari 准确?

发布于 2024-08-25 07:47:42 字数 1351 浏览 4 评论 0原文

我刚刚在 Firefox 3.6 和 iPhone Safari (os 3.1.3) 上测试了 Geolocation,结果很有趣,firefox 比 safari 更准确。任何人都知道如何使 iPhone Safari 结果更加准确。

测试结果

  • Windows Vista Firefox 3.6: ------------- 准确度: 150
  • iPhone 3G (os 3.1.3) Safari: ---------- - 准确度:828

这是测试代码:

navigator.geolocation.getCurrentPosition(handler, {enableHighAccuracy: true});

function handler(location) {
    var message = document.getElementById("message");
    message.innerHTML = "<img src='http://maps.google.com/staticmap?sensor=true&center=" + location.coords.latitude + "," + location.coords.longitude + "&size=300x300&maptype=street&zoom=16&key=ABQIAAAAZrVtlT2df2pkfI_RZB_6WBRWTAkRKJS7h1XjKaOTqACHuw1n0BT5cATkkKFnZNGHmrwUw9IilQK0Eg' />";
    message.innerHTML+="<p>Longitude: " + location.coords.longitude + "</p>";
    message.innerHTML+="<p>Latitude: " + location.coords.latitude + "</p>";
    message.innerHTML += "<p>Accuracy: " + location.coords.accuracy + "</p>";

    // call the function with my current lat/lon
    getPlaceFromFlickr(location.coords.latitude, location.coords.longitude, 'output');
}

。 。

从这里进行测试

I just tested Geolocation on Firefox 3.6 and iPhone Safari (os 3.1.3), the result is interesting, firefox is more accurate than safari. any one got idea how to make iPhone Safari result more accurate.

Testing Resul

  • Windows Vista Firefox 3.6: ------------- Accuracy: 150
  • iPhone 3G (os 3.1.3) Safari: ----------- Accuracy: 828

this is the code for testing:

navigator.geolocation.getCurrentPosition(handler, {enableHighAccuracy: true});

function handler(location) {
    var message = document.getElementById("message");
    message.innerHTML = "<img src='http://maps.google.com/staticmap?sensor=true¢er=" + location.coords.latitude + "," + location.coords.longitude + "&size=300x300&maptype=street&zoom=16&key=ABQIAAAAZrVtlT2df2pkfI_RZB_6WBRWTAkRKJS7h1XjKaOTqACHuw1n0BT5cATkkKFnZNGHmrwUw9IilQK0Eg' />";
    message.innerHTML+="<p>Longitude: " + location.coords.longitude + "</p>";
    message.innerHTML+="<p>Latitude: " + location.coords.latitude + "</p>";
    message.innerHTML += "<p>Accuracy: " + location.coords.accuracy + "</p>";

    // call the function with my current lat/lon
    getPlaceFromFlickr(location.coords.latitude, location.coords.longitude, 'output');
}

.
.

test from here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

许你一世情深 2024-09-01 07:47:42

Firefox 使用 Google 的位置数据库,而 Safari 使用 Skyhook,因此您确实无能为力

Firefox uses Googles Database of locations while Safari Uses Skyhook, so there really isn't anything you can do

幸福不弃 2024-09-01 07:47:42

尝试使用 navigator.geolocation.watchPosition 来跟踪当前位置 - 也许通过多次更新,准确性会提高。请参阅 Safari 网页内容指南 - 获取地理位置

Try using navigator.geolocation.watchPosition to track the current location -- maybe the accuracy will improve with multiple updates. See Safari Web Content Guide - Getting Geographic Locations

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文