HTML and CSS Reference
In-Depth Information
Table 7-1. Coordinates Object Properties
Property
Description
Coordinates.timestamp
The time that the position was retrieved
Coordinates.coords
A coordinates object
Coordinates.coords.accuracy
The level of accuracy of the latitude and
longitude result
Coordinates.coords.altitude
If available, the altitude of the device in
meters; if this cannot be determined, null is
returned
Coordinates.coords.altitudeAccuracy
The accuracy of the altitude result; if this
cannot be determined, null is returned
Coordinates.coords.heading
The heading of the device, or the direction
of the device in degrees. If the heading
cannot be determined, the value of this
property is null
Coordinates.coords.latitude
The latitude of the device in decimal degrees
Coordinates.coords.longitude
The longitude of the device in decimal
degrees
Coordinates.coords speed
The horizontal speed of travel in meters per
second; if this cannot be determined, null is
returned
To then retrieve the coordinates of the device, it is a simple case of querying the
device for the user's location, like so:
navigator.geolocation.getCurrentPosition(showCurrentPosition);
If the user hasn't already authorized your application to access their location,
they will first be required to approve the location request. Figure 7-2 shows what
this dialog will look like.
Search WWH ::




Custom Search