HTML | DOM Geolocation coordinates Property
The DOM Geolocation coordinates Property in HTML is used to return the position and altitude of the device on Earth. The returned Coordinates object could be used for various purposes including navigation and tracking the position of the device.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
|coordinates.latitude||This is the device latitude in decimal degrees.|
|coordinates.longitude||This is the device longitude in decimal degrees.|
|coordinates.accuracy||This is the accuracy of the latitude and longitude returned in meters.|
|coordinates.altitude||This is the device altitude relative to the sea level in meters.|
|coordinates.altitudeAccuracy||This is the accuracy of the altitude returned in meters.|
|coordinates.heading||This is the direction in which the device is traveling. The value is in degrees and indicates the current direction with respect to true north. This value may be null.|
|coordinates.speed||This is the velocity of the device in meters per second. The value may be null if the device is not traveling.|
Usage: Methods like getCurrentPosition() or watchPosition() are used to pass a callback to a function and then access the coordinates property.
Before clicking the button:
After clicking the button:
Supported Browsers: The browser supported by DOM Geolocation coordinates property are listed below:
- Google Chrome 5.0
- Firefox 3.5
- Internet Explorer 9.0
- Opera 10.6
- Safari 5.0