The HTML Geolocation API is used to get the geographical position of the user. Since this can compromise privacy, the position is not available unless the user approves it.
getCurrentPosition() - Get current position oncewatchPosition() - Track position changesclearWatch() - Stop trackingcoords.latitudecoords.longitudecoords.accuracycoords.altitudecoords.speedEdit the code below and click Run to see the result live.