地理定位Firefox比iPhone Safari准确吗?

时间:2010-03-19 02:38:36

标签: iphone firefox safari geolocation

我刚刚在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');
}

test from here

2 个答案:

答案 0 :(得分:0)

当Safari使用Skyhook时,Firefox使用Googles数据库,因此您无法做任何事情

答案 1 :(得分:0)

尝试使用navigator.geolocation.watchPosition来跟踪当前位置 - 也许通过多次更新可以提高准确性。见Safari Web Content Guide - Getting Geographic Locations