长轮询中 iphone 上 safari 的加载指示器
我正在尝试使用 XMLHttpRequest 进行长轮询。它在所有支持的浏览器上工作正常,但由于某种原因,在 iPhone 上的 safari 上,我得到每个 ajax 调用的加载指示器,而对于长轮询,这有点烦人。
我读到您需要等待文档加载,但它不起作用。还有其他已知的黑客可以解决它吗?
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.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也遇到过同样的问题,我尝试使用简单的 XHRO、隐藏的 iFrames 等,但它在 iPhone 上不起作用。在加载“整个”文档之前,它似乎不会更新 DOM 或执行任何操作,在我的示例中,这就是长轮询的持续时间。
我唯一没有尝试过的是 JSONP。也许你可以尝试一下 JSONP。
请告诉我们您是否能够尝试 JSONP 以及它是否有效或者是否有任何效果!
更新:我不知道为什么这被标记为答案,我不认为是这样,所以请让我知道如何将其设为评论而不是答案。
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.
我也遇到过同样的问题。
让长轮询(或者任何真正的轮询)在所有浏览器上运行是一件令人兴奋的事情。尤其是野生动物园。善良。
socket.io 是一个解决方案。
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.