Mac*_*iek 25 javascript gps mobile-phones geolocation mobile-website
iPhone通过以下调用支持移动Safari中的地理位置:
navigator.geolocation.getCurrentPosition(
  function(pos){
    var lat = pos.coords.latitude;
    var long = pos.coords.longitude;
  },
  function(){
    /* Handler if location could not be found */
  }
);
我想建立一个包含以下其中一项的良好设备列表:
我只熟悉自己的设备,所以到目前为止这是我的列表:
?
Blackberry,Android手机等的支持程度如何?
小智 17
截至今天,W3C Geolocation API(与HTML 5广泛关联,但在技术上并非如此)在以下主要桌面浏览器中得到支持:
至少有两个移动浏览器实现了Geolocation API:
在所有这些平台上,您应该能够使用navigator.geolocation.getCurrentPosition等.
虽然我认为在W3C Geolocation API标准化(草案,顺便说一句)W3C Geolocation API是一个很好的做法,但值得注意的是浏览器中还有一些其他选项,如果您需要定位较旧的平台,这可能会特别有用.
navigator.geolocation具有非常相似语法的调用.