jQuery的AJAX停止了与iOS 5.0.1工作 [英] jquery AJAX stopped working with iOS 5.0.1
问题描述
下面的逻辑块用于所有的移动设备都jQuery的1.4.4和1.7.1,我们正在支持的工作:
The following piece of logic used to work with both jquery 1.4.4 and 1.7.1 on all mobile devices that we're supporting:
$.ajax({
url: 'http://www.example.com/someurl',
type: 'GET',
dataType: 'text',
timeout: 60000,
success: function(data) {
alert(data);
},
error: function(jqXHR) {
alert(jqXHR.state());
}
});
不过,与iOS 5.0.1,上述进入错误警报功能拒绝
没有任何实际的HTTP请求。如此看来,仅有一个AJAX请求将工作之前,我需要重新启动我的iPhone。
这是一个已知的jQuery /的iOS 5.0的问题?我该如何调试呢?有没有什么解决方法吗?我不知道从哪里开始寻找。
But with iOS 5.0.1, the above enters the error function alerting rejected
without any actual HTTP requests. It seems that exactly one AJAX request will work before I need to restart my iPhone.
Is this a known jquery / iOS 5.0 problem? How can I debug it? Is there any workaround? I don't know where to start looking.
注意:我注意到在服务器端,而不是该 GET
的要求,选项
请求发出。这似乎是一个相关的问题:
NOTE: I've noticed on the server side, that instead of GET
requests, OPTIONS
requests are issued. This seems to be a related issue:
<一个href="http://spin.atomicobject.com/2012/01/20/mobile-safari-on-ios-5-1-unexpectedly-making-cross-origin-resource-sharing-requests/" rel="nofollow">http://spin.atomicobject.com/2012/01/20/mobile-safari-on-ios-5-1-unexpectedly-making-cross-origin-resource-sharing-requests/
推荐答案
这是我的问题,提供的链接实际上是指向解决方案。我的一些Ajax请求被用来获取的URL这是使用流式传输的PDF文档
The link that I provided in the question is actually pointing to the solution. Some of my ajax requests are used to fetch URL's of PDFs which are streamed using
Content-Disposition: attachment; filename="somename.pdf"
显然,这导致的iOS 5.0的Safari浏览器的重大问题,打破了 XMLHtt prequest
对象(不与jquery相关)。疯。在这里,我们再次链接:
Apparently, that causes major issues in iOS 5.0's Safari, breaking the XMLHttpRequest
object (it is not related with jquery). Crazy. Here's the link again:
<一个href="http://spin.atomicobject.com/2012/01/20/mobile-safari-on-ios-5-1-unexpectedly-making-cross-origin-resource-sharing-requests/">http://spin.atomicobject.com/2012/01/20/mobile-safari-on-ios-5-1-unexpectedly-making-cross-origin-resource-sharing-requests/
这篇关于jQuery的AJAX停止了与iOS 5.0.1工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!