HTML and CSS Reference
In-Depth Information
The locatedFailed() function will run when the location was unable to be ob-
tained. The parameter handed to it is a PositionError object that contains an error
code and a message. The following are possible errors:
Error code 1, permission denied : The user didn't authorize using geolocation.
Error code 2, position unavailable : The position can't be determined.
Error code 3, position retrieval timed out : Retrieving the position took too long.
If you want to test this function, the easiest way is to deny the geolocation request
from the browser. Depending on the browser and whether you accepted the previous re-
quest for geolocation information, the browser will remember your choice and won't ask
you again. Google Chrome, for instance, will require you to click the “target" icon in
right of the address bar where you will have the option to clear the geolocation settings
(the page will need to be reloaded for the settings to take effect). Figure A-1 shows what
this dialog looks like. For Firefox, the geolocation permissions are found under Tools
Page Info, which will open a dialog box with information about the page currently being
viewed. Selecting the Permissions tab will allow you to set the preferences for sharing
location information with a particular page. Safari has location settings set in its Privacy
tab in the browser's Preferences pane. If you are unsure of where to clear geolocation
information in your preferred browser, check in the application's preferences or the right
side of the address bar, because these are the usual locations for the geolocation permis-
sion settings.
Figure A-1. Dialog for clearing geolocation settings for a page being viewed in Google Chrome
Search WWH ::

Custom Search