O'Reilly logo

The Definitive Guide to HTML5 by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

C H A P T E R  38

Using Geolocation

The Geolocation API allows us to obtain information about the current geographic position of the user (or at least the position of the system on which the browser is running). This isn't part of the HTML5 specification, but it is usually grouped up as part of the new features associated with HTML5. Table 38-1 provides the summary for this chapter.

Image

Using Geolocation

We access the geolocation feature through the global navigator.geolocation property, which returns a Geolocation object – the methods of this object are described in Table 38-2.

Getting the Current Position

As its name suggests the getCurrentPosition ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required