I had a similar problem and I also use html5 geolocation.
I have already implemented the proposed setInterval() solution. The same problem still occurred, although it took much longer.
I did some experimentation by putting the following code snippet in my code, just to โpauseโ the code:
ms = 30000; ms += new Date().getTime(); while (new Date() < ms){ }
The above snippet reliably generates a javascript runtime. I discreetly discovered that the following snippet will generate a timeout. But it looks like the browser can restore the timeout. Do not ask me why. It just works. I hope that the victims will be able to verify my findings.
ms = 30000; ms += new Date().getTime(); while (new Date() < ms){ if (new Date() %100 == 0){ console.log('in while'); } }
So, the solution seems trivial, it might seem that console.logs should be added to the parts of the code that gets called most often. I hope this can be useful (although I think it is funny too, but it works for me)
source share