In HTML5, the Geolocation API is used to obtain the user's geographical location. Geolocation is much more accurate for devices with GPS, like smartphones and the like.