Position

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

Position 接口表示在给定的时间的相关设备的位置。这个位置,用一个Coordinates对象表示,包括设备在地球上的二维位置,但也可以包括设备的海拔和速度。

属性

Position接口没有继承任何属性。

Position.coords 只读

返回一个定义了当前位置的Coordinates 对象。

Position.timestamp 只读

返回一个时间戳DOMTimeStamp,这个时间戳表示获取到的位置的时间。

方法

Position 接口没有实现也没有继承任何方法。

规范

Specification
Geolocation
# position_interface

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
GeolocationPosition
coords
Secure context required
timestamp
toJSON

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Uses a non-standard name.
Has more compatibility info.

参阅