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

View in English Always switch to English

GeolocationCoordinates:heading 属性

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月.

安全上下文: 此特性仅在一些支持的浏览器安全上下文(HTTPS)中可用。

GeolocationCoordinates 接口的 heading 只读属性是表示设备当前的移动方向的 double 类型值,指示设备朝向偏离正北方向的角度大小(单位为角度)。0 度表示正北方向,且角度按顺时针方向计算(即:东为 90 度,西为 270 度)。如果 GeolocationCoordinates.speed0,或设备无法提供航向信息,则 heading 的值为 null

表示设备当前的移动方向的 double 类型值。

规范

Specification
Geolocation
# heading-attribute

浏览器兼容性

参见