地理位置查询:geolocation

window.navigator.geolocation

  该对象下总共有3个方法

 Geolocation {getCurrentPosition: function, watchPosition: function, clearWatch: function}

getCurrentPosition( successCallback , errorCallback , optipns)

第三个参数可用值:
  enableHighAccuracy 更精确的定位。 会耗费较长时间。
  timeout        以毫秒为单位为最大时间间隔 指该程序回调时间
  maximunAge      缓存当前的信息,单位为毫秒 成功调用以后传回一个对象:Geoposition {timestamp: 1378291155076, coords: Coordinates}
//coords下存储了 纬度 经度
coords.latitude
coords.longitude 

coords.speed //移动速度 
还有其他返回值 : 高度值、高度值的精确度、给予的经纬度的精确度、相对于正北的角度

监听移动设备地理位置:

watchPosition / clearWatch

watchPosition 跟上面的getCurrentPosition 是同样的原理,参数,返回值。只不过它是个定时器版本的。
clearWatch就是来清除watchPosition 的。

 

HTML5API___geolocation的更多相关文章

随机推荐

  1. Servlet学习第一天--Servlet开发映射URL配置

    基础不扎实,从头学,认真记录笔记. 感谢@孤傲苍狼:http://www.cnblogs.com/xdp-gacl/p/3760336.html -为什么要配置? 由于客户端是通过URL访问web服务 ...

  2. [原]容器学习(二):动手模拟AOP

    简单来说,Spring是一个轻量级的控制反转(IOC)和面向切面(AOP)的容器框架.上文已经介绍模拟IoC实现,这篇文章来动手模拟AOP. AOP简述 面向对象强调"一切皆是对象" ...

  3. centos 6.7 perl 版本 This is perl 5, version 22 安装DBI DBD

    <pre name="code" class="cpp">centos 6.7 perl 版本 This is perl 5, version 22 ...

  4. SDOTOJ2088 refresh的停车场(栈和队列)

     refresh的停车场 Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit S ...

  5. android插件化-apkplugdemo源代码阅读指南-10

    阅读本节内容前可先了解 apkplug基础教程 本教程是基于apkplug V1.6.8 版本号编写  最新开发方式以官网为准 可下载最新的apkplugdemo源代码http://git.oschi ...

  6. go-vim配置

    一.环境准备: 系统环境说明: [root@docker golang]# cat /etc/redhat-release CentOS Linux release (Core) [root@dock ...

  7. appium locator

    If you want to find out more about the UIAutomator library, then it might be helpful to check out ht ...

  8. 二、获取AccessToken

    二.获取AccessToken 1.官方文档: access_token是微信官方公众号调用接口的全局唯一票据,开发者调用任何接口都需要使用access_token,由于access_token有效期 ...

  9. 桦仔 笔记4-徐 模仿灾难发生时还原adventurework数据库 示例 stopat

    1 --模仿灾难发生时还原adventurework数据库 示例 stopat 2 3 BACKUP DATABASE AdventureWorks 4 TO DISK= 'D:\MSSQL\Data ...

  10. Css 使div标签下沉到页面最低部

    .footer{ position:fixed; bottom:0; } 使用这两个标签就能达到效果