I'm trying to do a long polling using XMLHttpRequest. it works fine on all supporting browsers, but for some reason on safari on iPhone i get the loading indicator for every ajax call, and for long polling thats a bit annoying.开发者_JAVA技巧
I read that you need to wait until the document is loaded, but it doesn't seam to work. any other known hack to solve it?
I have had the same problem , I tried using simple XHRO, hidden iFrames etc , it just does not work on iPhone. It seems to not update the DOM or do anything until the the "entire" document is loaded which, in my example was the duration of the long poll.
The only thing I havent tried is JSONP. Maybe you can try JSONP.
Please let us know if u were able to try JSONP and if it worked or if anything worked at all!
UPDATE: I dont know why this is being marked as an answer, I dont think it is, so please let me know how to make it a comment instead of answer.
I have had the same problem as well.
Getting long-polling (or any polling really) to work on ALL browsers is a kick in the pants. And especially safari. Goodness.
socket.io is a solution.
精彩评论