哪些设备通过navigator.geolocation支持Javascript地理定位? [英] Which Devices Support Javascript Geolocation via navigator.geolocation?

查看:94
本文介绍了哪些设备通过navigator.geolocation支持Javascript地理定位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iPhone通过以下调用支持移动Safari中的地理位置:

  navigator.geolocation.getCurrentPosition(
function (pos){
var lat = pos.coords.latitude;
var long = pos.coords.longitude;
},
function(){
/ *处理程序,如果找不到位置* /
}
);

我想创建一个包含以下内容的设备列表:


  1. 支持此功能开箱即用

  2. 支持此功能升级或
  3. 支持具有与其他Javascript代码片段相同的数据保真度的地理定位。



<



开箱即用:


$ b我只熟悉自己的设备,所以这是我的列表。 $ b


  1. iPhone 3GS



支持,但仅支持更新




  1. iPhone 3G

  2. iPhone 2G(?)

  3. Firefox 3.5



受其他片段支持





黑莓,Android手机等的支持程度如何?虽然我认为这是一个很好的做法,标准化(博士船尾,顺便说一句) W3C Geolocation API ,值得注意的是那里是浏览器中的一些其他选项,如果您需要定位到较旧的平台,这可能特别有用。


  • Firefox 3.1支持 Geode ,它使用对 navigator的调用。 geolocation ,语法非常相似。
  • Loki是由Skyhook构建的插件,可用于Internet Explorer 6,Internet Explorer 7,Firefox 2,Firefox 3, Safari和Opera。语法是完全不同,但仍然很简单

  • Google Gears提供了一个地理定位API ,其语法与W3C API非常相似句法。您可以在Internet Explorer 6+,Firefox 1.5+,Safari,Opera Mobile和IE Mobile上安装Google Gears。


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:

  1. support this feature out of the box, or
  2. support this feature with an upgrade, or
  3. support geolocation with equivalent fidelity of data with some other snippet of Javascript.

I'm only familiar with my own device, so this is my list so far:

Out of the box:

  1. iPhone 3GS

Supported, but only with an update

  1. iPhone 3G
  2. iPhone 2G (?)
  3. PC or Mac computer with Firefox 3.5

Supported with some other snippet

?

What is the level of support in Blackberry, Android phones, etc?

解决方案

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 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.

这篇关于哪些设备通过navigator.geolocation支持Javascript地理定位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆