the geolocation implementation is quite good and got few steps to observe but only on thing is missing, i guess. Im not able to see if the user accepted the request or not ( before i get the position object ), i dunno if the user just ignores my request ( during my timeout ) or if the request just get lost ( and the failure callback doesnt get called for no reason ).
It would be useful to set a timestamp when the user accepts the request, i couldnt find anything which gives me that kind of response.
Tested it successful in FF 3.5, Opera 10.6, Chrome8, IE6-8..
With that workaround we know if the request timedout, even when the succeess / failure callback get called afterwards.
Based on my new understanding of what you are after, you want something like this. (Tested: in Opera - works, Firefox 3.6 & Chrome 8 - not so much (I need more time to debug))
Scenario: Page attempts to get location... but user ignores the prompt completely thus there is no (accept or deny) and since the request for the location is never sent, there is no timeout either!
Based on this you may want to add your own logic to handle this scenario. For the sake of this example, I'm going to prototype my own "wrapper" method. (for the picky - I'm not condoning using globals etc. I was just trying to get something to work)
The concept is to set up a timer first (defaults to 30 seconds if not set). If the user doesn't do anything before the timer expires, a timeoutCallback is called.
Notes:
It is part of the Geolocation API:
If you specify the errorCallback... then you can track if the user has declined to provide access.
Possible error codes include: