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