HTML5 Game - Position object and Coordinates object from navigator.geolocation property

Introduction

The Position object is listed in the following table.

Name Description Returns
coords Returns the coordinates for the current position Coordinates
timestampReturns the time that the coordinate information was obtainedstring

The Coordinates object is returned by the Position.coords property.

The following table describes the properties of the Coordinates object.

NameDescription Returns
latitudeReturns the latitude in decimal degrees number
longitude Returns the longitude in decimal degreesnumber
altitudeReturns the height in metersnumber
accuracyReturns the accuracy of the coordinates in meters number
altitudeAccuracyReturns the accuracy of the altitude in meters number
heading Returns the direction of travel in degrees number
speed Returns the speed of travel in meters/secondnumber

Not all of the data values in the Coordinates object will be available.

Related Topic