September 2024
Beginner to intermediate
985 pages
35h 37m
English
Thanks to the Geolocation API (www.w3.org/TR/geolocation-API), it’s possible to determine the location or position of a user. We’ll show you how to do this in the following sections.
The entry point for the Geolocation API is the geolocation property of the navigator object. To get the current position of the user, the geolocation object (of the Geolocation type) provides the getCurrentPosition() method.
Because the position is determined asynchronously, a function is passed to the method as a callback handler, which is called as soon as the position has been determined. Within this function, various information can then be accessed, as shown in Listing 12.48 ...
Read now
Unlock full access