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
Microsoft Developer Network: Windows Internet Explorer API reference Article