views:

91

answers:

2

Is it possible to still use the geolocation features when you are in offline mode in HTML5? It appears that when I am online (navigator.onLine = true), the geolocation works fine. But when I go offline (navigator.onLine = false), I get thrown to my error callback and the error indicates geolocation not available.

A: 

I don't really have an answer for you, but you might try setting a high maximumAge in the PositonOptions structure to see if it will give you an out of date one at least.

notJim
Thanks, I did try that, and it didn't work. I'm almost sure I had this working, maybe I had a flaw in my code that made it appear that it was working. Hopefully someone will have an idea. Thanks.
HunterX3
Sorry I couldn't help, good luck!
notJim
+2  A: 

It's going to depend on how the GeoLocation in that particular browser is wired up. In Firefox, GeoLocation depends on Google Location Services which works by sending some network information to a web service - obviously this is not going to work when you're offline as the web service will not be available.

If you had a browser which communicated directly with GPS hardware then it would work offline, but I don't think you'll find any desktop browsers with that sort of integration - maybe some mobile ones will.

robertc
Thanks for the info. I had no idea that Google location services was involved for Firefox. In my case, is mobile safari. Do we know how that is wired up?
HunterX3
@HunterX3 I can't find any documentation either way, unfortunately. I guess if it's not working for you then that indicates it's not using the GPS.
robertc
Geolocation currently doesn't work with Firefox (3.6.9) due to an internal JavaScript error on their part.
Ian Devlin