Synchronous AJAX call fails on iPad, but not other platforms and browsers
Does anyone know why a synchronous ajax call would fail and give the following error on Safari on an iPad, but the same code works fine on all other platforms and browsers I'v开发者_开发问答e tested so far?
NETWORK_ERR: XMLHttpRequest Exception 101: A network error occurred in synchronous requests.
That error suggests that I'm attempting a cross-domain request, but I'm not; the requested URL is on the same host, and in fact it's a relative URL. Even in trivial tests, this fails on the iPad (and works on all other platforms and browsers, including Safari), so I'm confident I've ruled out any possibility of a time out.
Also, the same request, if made asynchronously, works perfectly on the iPad; it's only synchronous requests that give the 101 exception. It's driving me crazy!
One more bit of detail: this only happens on my production server. The synchronous ajax call actually works fine on my development server. Both servers require the same client certificate... so I don't think there's any difference there. I can't think of any difference between the two servers that could have an effect here.
Any insight into this problem would be greatly appreciated. Thanks!
It turns out the key difference between our development and production systems is the certificate requirement.
The issue turns out to be a problem with the way XMLHttpRequest.send() on the iPad version of Safari processes a synchronous request on a domain that is certificate-protected. I can't explain the internals of the method, but somehow it has a problem and throws the 101 exception, believing it--apparently--to be a cross-domain request. Again, the same request made asynchronously on the same certificate-protected server works just fine. Frustrating case, and one with no solution!
精彩评论