HTML and CSS Reference
In-Depth Information
It's not possible to find out exactly which technology was
used to provide the positioning information. But you can
get an idea how accurate the figure is likely to be, because
the coords object also includes an accuracy property.
Here's a new version of the previous example, this time displaying the
accuracy.
Using the accuracy is straightforward. the only change that
needs to be made to the previous listing is an extra line in the
code where you write the results to the page.
the accuracy
is a value in
meters.
document.getElementById('location').innerHTML =
'Latitude: ' + position.coords.latitude +
' Longitude: ' + position.coords.longitude +
' with an accuracy of: ' + position.coords.accuracy + 'm'
These lines are
unchanged.
The coords object also has
an accuracy property.
Finding your location continuously
What if you want to continuously track the user's position? You could
just call getCurrentPosition() repeatedly, but that's a waste if the user is
stationary, and it could drain battery life on hand-held devices. A better
 
Search WWH ::




Custom Search