HTML5 location, html5 location
1. Use navigator. geolocation to obtain the current location of the device. Return a location object to obtain information about the current longitude and latitude;
2. Three Methods of navgatior. geolocation:
GetCurrentPosition ();
WatchPosition ();
ClearWatch ();
3. getCurrentPosition () Usage
Navigator. geolocation. getCurrentPosition (successCallback, [errorCallback], [positionOptons]);
A) SuccessCallback: gets the callback function eg: function (position) {alert ("latitude:" + position. coords. latitude + "; longitude:" + position. coords. longpolling )};
SuccessCallback returns a geographic data object position as the parameter, which has the attributes timestamp and coords. Timestamp indicates the Geographic Data creation time (timestamp). coords includes the following seven attributes:
1. coords. latitude: Estimated latitude
2. coords. longpolling: Estimated longitude
3. coords. altitude: Estimated height
4. coords. accuracy: accuracy of latitude and longitude estimates in meters
5. coords. altitudeAccuracy: accuracy of the provided height estimates in meters
6. coords. heading: The angle direction of the current movement of the host device, clockwise relative to the north direction
7. coords. speed: current local speed of a device in meters per second