Coordinates.heading

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.

Coordinates.heading 是個唯讀的正複數用來代表裝置前進的方向。這個數值代表你偏離北方多少度,0 度代表你向著正北方,照著順時針的方向遞增(90 度代表正東方,270 度代表正西方)。如果Coordinates.speed 為 0 度,則此值為 NaN。如果這個裝置無法提供這個值則回傳 null。

語法

heading = coordinates.heading

規格

Specification
Geolocation
# heading-attribute

瀏覽器的相容性

BCD tables only load in the browser

請參考