I've built the Geolocation API into my webapp and all browsers are working fine. Except Safari 8 and 7.1. The browser keeps asking for permission after allowing or not allowing it and ends up in an infinite loop making the browser (tab) unusable. It's easily reproducible by just going to http://html5demos.com/geo in Safari.
Is there any fix for this or is this just a bug in Safari? I searched but couldn't find anything related.
Our team saw this too. At first we thought we might have been stuck inside some kind of loop that the other browsers ignored, so we instrumented the code and confirmed that the call was only happening once. We suspended JavaScript by forcing a breakpoint and the alerts kept coming (and coming, and coming...). At this point we were pretty sure the issue was not in our code.
On a whim I placed the call to the GeoLocation API inside a setTimeout
(to allow the call stack to empty) and the problem went away. No idea why that would fix the issue. . .
Edit
Per request, I put up an example @ https://jsfiddle.net/r8hst2zp/1/
i don't think it is a bug in safari, you can try the following example, it worked fine for me:
http://www.w3schools.com/html/html5_geolocation.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With