6

Has anyone out there had to deal with and managed to find a viable workaround for the Firefox 5 geolocation issue I posted in the following bug report. It's easier to link to the report than re-describe it here.

https://bugzilla.mozilla.org/show_bug.cgi?id=675533

Surely I'm not the only one on the planet this has bitten.

1
  • 1
    Same problem here. The engineers commenting in the bug report make a good point (your UI should gracefully handle the case where no response was received), but in my opinion it should timeout and therefore trigger the error callback in that case. Nov 17, 2011 at 23:58

2 Answers 2

2

This doesn't really solve the root of your problem but my strategy for handling this is setting a default location point that I use right away (not waiting for the geolocation question to be answered).

If I get a location from the user, I just change it to the new location. If I get a rejection or no answer at all, I just stay on the default location.

It's also my experience that a desktop client (in my case Firefox on a stationary Windows computer) takes much longer to respond than a mobile client (in my case Safari on iPhone). I was forced to set the timeout to 10 seconds (10000) to give the desktop client enough time to respond. So if you have a map, initializing it and centering on a default location directly will give the user a map on the screen much faster than if you have to wait for a response.

Good luck with your positioning project!

0
2

I might be a bit late but hope I can help others. My workaround is based on a delayed call. If there is no fix when the delayed call is fires, I become suspicious :)

var timeIsPassig = false;

function anyThing(){
  timeIsPassig = true;
  setTimeout(
    function(){
      if (timeIsPassig) {
        timeIsPassig = false;
        console.log("Waiting too much... Or did you say not now? :-P");
        }
      },
    10000
    );
  navigator.geolocation.getCurrentPosition(
    function (pos) {timeIsPassig = false; /* rest of positioning*/},
    function (err) {timeIsPassig = false; /* rest of error handling*/},
    {maximumAge: 30000, timeout: 10000, enableHighAccuracy: true}
    )
  }
1
  • Good answer. And it also solves the case that the Mozilla devs are making — that we should handle the "what if the user ignores it" case. Incidentally IE11 doesn't even have a "deny it this time" option, so this is the solution I'm recommending to my development team. Feb 19, 2016 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.