获得从启用GPS的装置当前的经纬度 [英] get current latitude and longitude from gps enabled device

查看:189
本文介绍了获得从启用GPS的装置当前的经纬度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从启用的移动设备从网络浏览器GPS获取当前位置的经度和纬度。我想知道这可能吗?怎么做?它需要地理位置API?一些编码例子将是有益的。谢谢。

I would like to get the latitude and longitude of current location from gps enabled mobile device right from the web browser. May I know is this possible? how to do it? does it require geolocation api? Some coding example would be helpful. Thanks.

推荐答案

使用HTML5的地理位置API,这里的的官方规格和范例

Use the HTML5 Geolocation API, here's the official spec and examples.

修改

我已经更新了我的答案,包括当前浏览器的支持。

I've updated my answer to include current browser support.

W3C地理位置API支持

Firefox 3.5+
Safari 5.0+
Chrome 5.0+
Opera
iPhone 3.0+
Android 2.0+

··结果
其他手机没有列出上面使用齿轮或自己的,特定于平台的API。

· ·
Other phones not listed above use Gears or their own, platform-specific APIs.

  • W3C geolocation API
  • Gears
  • BlackBerry geolocation API
  • Nokia geolocation API
  • Palm geolocation API
  • OMTP BONDI geolocation API

啊,我们到底有只是一个单一的API? :)

Ahh, will we ever have just one single API? :)

非常感谢马克朝圣者为他的真棒帖子

Many thanks to Mark Pilgrim for his awesome post.

这篇关于获得从启用GPS的装置当前的经纬度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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