Geolocation 对象允许用户向 Web 应用程序提供他们的位置。出于隐私原因,需要获得用户报告位置信息的许可。
笔记:此功能仅在安全上下文 (HTTPS) 中可用。
笔记: 对于配备 GPS 的设备(例如 iPhone)来说,地理定位最为准确。
地理定位 API 通过以下方式发布导航器.地理位置目的。
Property | Description |
---|---|
coordinates | Returns the position and altitude of the device on Earth |
position | Returns the position of the concerned device at a given time |
positionError | Returns the reason of an error occurring when using the geolocating device |
positionOptions | Describes an object containing option properties to pass as a parameter of Geolocation.getCurrentPosition() and Geolocation.watchPosition() |
Method | Description |
---|---|
clearWatch() | Unregister location/error monitoring handlers previously installed using Geolocation.watchPosition() |
getCurrentPosition() | Returns the current position of the device |
watchPosition() | Returns a watch ID value that then can be used to unregister the handler by passing it to the Geolocation.clearWatch() method |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!