This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

heading

Summary

Denotes the direction of travel of the hosting device specified in degrees, where 0° ≤ heading < 360°, counting clockwise relative to the true north. If the implementation cannot provide heading information, the value of this attribute must be null. If the hosting device is stationary (i.e., the value of the speed attribute is 0), then the value of this attribute must be NaN.

Property of apis/geolocation/Coordinatesapis/geolocation/Coordinates

Syntax

Note: This property is read-only.

var result = Coordinates.heading;

Return Value

Returns an object of type NumberNumber

Examples

if (position.coords.heading > 87 && position.coords.heading < 93) {
   // moving within 5 degrees of due east
   } else {
   // not moving east
   }

Related specifications

W3C Geolocation Specification
W3C Editor’s Draft

Attributions