HTML and CSS Reference
In-Depth Information
An example can be seen at . Upon visit-
ing the site, if geolocation is available, it reloads the page with
your position loaded (see Figure 9.4 ), showing you where you
can go owl hunting, if that's the activity that gets you going after
a day of HTML5 development. If geolocation isn't available, it
simply asks you to enter your location.
FIGURE 9.4 An example of
progressively enhancing using
Geo 404: the error handler
The second argument to the getCurrentPosition and
watchPosition method is the error handler. This is particularly
important if you want to provide some alternative method of
location (such as manually) or you want to notify the user of any
errors in getting her position. The error handler may trigger if
the user denies her position, but it could be that the user has
given you permission and now you are watching her position on
a mobile device and the phone has gone out of reception. This
too would cause the error handler to trigger.
The error handler receives a single argument containing a posi-
tion error object containing two properties:
readonly attribute unsigned short code
readonly attribute DOMString message
Search WWH ::

Custom Search