HTML and CSS Reference
In-Depth Information
The message property is useful for developing and debugging
but wouldn't be appropriate to show the user. It's not because
it's some cryptic rubbish from the GPS onboard chips, but
because it's bespoke to each browser (as it's not defined in the
specification), but also because it's rather computery speak—not
friendly to your visitor. The message property isn't always avail-
able (as it's not currently in Firefox 3.6+).
To g i v e y To u a n i d e a To f h To w t h e e r r To r h a n d l e r c a n b e u s e d ,
here's a simple example:
if (navigator.geolocation) {
¬ (position) {
var coords = position.coords;
showMap(coords.latitude, coords.longitude,
¬ coords.accuracy);
}, function (error) {
var errorTypes = {
1: 'Permission denied',
2: 'Position is not available',
3: 'Request timeout'
alert(errorTypes[error.code] + “: means we can't
¬ determine your position”);
If your page uses this code and the user, when prompted,
doesn't allow the page access to the current location informa-
tion, they'll receive a stern alert box “Permission denied: means
we can't determine your position.”
Search WWH ::

Custom Search