HTML and CSS Reference
In-Depth Information
Although it's neat that you can perform calculations on the coordinates
you get from the Geolocation API , most users probably aren't bothered
by exactly how far they are, as the crow flies, from Tim Berners-Lee's
birthplace, or any other famous landmark. It's also likely that, outside
of geocachers, most people aren't too interested in their exact latitude
and longitude. They're far more likely to want to know where they are
in some sort of sensible context—in other words, on a map.
Google offers a free service for the basic display of a map on a web
page. The next example takes the information from the Geolocation
API and uses it to call up a map of the user's current location.
The Google Maps API requires some parameters as part of a URL . The
URL can be built in the writeLoc() function and then set to be the
source of an image element. For convenience, create an empty image
element in your page where the map is to appear:
<img id="location">
Search WWH ::

Custom Search