此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

Position

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2020年7月⁩.

* 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

浏览器兼容性

参阅