哪些设备支持通过 navigator.geolocation 进行 Javascript 地理定位?
iPhone 通过以下调用支持移动 Safari 中的地理定位:
The iPhone supports geolocation in mobile Safari via the following call:
navigator.geolocation.getCurrentPosition(
function(pos){
var lat = pos.coords.latitude;
var long = pos.coords.longitude;
},
function(){
/* Handler if location could not be found */
}
);
我想建立一个良好的设备列表,这些设备具有以下之一:
I'd like to build a good list of devices that have one of the following:
- 支持此功能开箱即用,或
- 通过升级支持此功能,或
- 支持与其他一些 Javascript 片段具有同等数据保真度的地理定位.
我只熟悉我自己的设备,所以这是我目前的清单:
I'm only familiar with my own device, so this is my list so far:
- iPhone 3GS
支持,但仅限更新
- iPhone 3G
- iPhone 2G (?)
- 装有 Firefox 3.5 的 PC 或 Mac 电脑
其他代码段支持
?
Blackberry、Android 手机等的支持程度如何?
What is the level of support in Blackberry, Android phones, etc?
推荐答案
虽然我认为标准化(顺便提一下)是一个很好的实践W3C Geolocation API,值得注意的是浏览器中还有一些其他选项,如果您需要针对较旧的平台.
Although I think it's a great practice to standardize on the (draft, by the way) W3C Geolocation API, it's worth noting that there are a few other options in the browser, which can be particularly helpful if you need to target an older platform.
- Firefox 3.1 支持 Geode,它使用调用
navigator.geolocation
语法非常相似. - Loki 是 Skyhook 构建的插件,适用于 Internet Explorer 6、Internet Explorer 7、Firefox 2、Firefox 3、Safari 和 Opera.语法大不相同,但仍然很简单.
- Google Gears 提供了一个 geolocation API,其语法与 W3C 非常相似API 语法.您可以在 Internet Explorer 6+、Firefox 1.5+、Safari、Opera Mobile 和 IE Mobile 上安装 Google Gears.
- Firefox 3.1 had support for Geode, which uses calls to
navigator.geolocation
with very similar syntax. - Loki is a plug-in built by Skyhook which works on Internet Explorer 6, Internet Explorer 7, Firefox 2, Firefox 3, Safari and Opera. The syntax is substantially different, but still easy.
- Google Gears provides a geolocation API with a syntax fairly similar to the W3C API syntax. You can install Google Gears on Internet Explorer 6+, Firefox 1.5+, Safari, Opera Mobile and IE Mobile.
相关文章