HTML and CSS Reference
In-Depth Information
altitude : The height of the position, gathered if the viewing device has the
capability to measure altitude
accuracy and altitudeAccuracy : The accuracy of the position as meas-
ured in meters
heading : The direction of travel as measured in degrees around a circle
speed : The speed of travel in a certain heading in meters per second
Note In addition to the timestamp and coords properties, Firefox includes an
address property for retrieving address information such as city, country, and even
street information!
Update the preceding locatedSuccess() function to print the location data on-
function locatedSuccess(geo) {
var lat = geo.coords.latitude;
var long = geo.coords.longitude;
An additional function name can be given to the getCurrentPosition() meth-
od to specify a function to run when the request for the user's location has failed. Edit
the init() code and add a locatedFailed() function:
function init() {
// get the current position
atedFailed" if
successful or not
(locatedSuccess, locatedFailed);
function locatedFailed(e) {
// log the error code and message
console.log(e.code , e.message);
Search WWH ::

Custom Search