This page shows off a bit of the geolocation api - gets the position upon page load, and then keeps track of position changes updating distance travelled (in terms of great circle distance).