HTML and CSS Reference
The geolocation API uses a few different techniques in acquiring
your position. Most of it is black magic to most people, includ-
ing myself, but it's worth having an idea about what's under the
hood as it will affect the accuracy of the position data.
GPS is one of the obvious methods for getting position data.
More computing devices are being fi tted out with GPS, rang-
ing from mobile phones to laptops. Assuming there's a clear
enough line to the GPS ground station (which picks up readings
from satellites to triangulate your position—yep, more black
magic), then you'll have a very accurate reading on your posi-
tion. GPS should also be able to give you altitude, which we saw
in the second grade of properties in the coordinates object. So
far this data isn't showing up in browsers, but I'd expect this to
become available in time as mobile computing evolves quickly.
Another method would be using network information, which
would be typical if used via a desktop browser such as Fire-
fox. The network information could use wifi triangulation and IP
addresses to make a best guess at your location. The developer
makes a call to the browser's geolocation API, which in turn the
browser makes a call to a third-party service such as Skyhook
or Google. Although this may not be as accurate as GPS (meter-
age-wise), it could make for a very good backup as GPS doesn't
work very well indoors or in highrise urban locations.
Overall it's not terribly important to know what makes geoloca-
tion tick, but if you need to get the high accuracy you might
want to be wary of using the more power-hungry devices such
as GPS and be wary of killing your user's battery.
All in all, it's some very cool black magic.