Note that there are some explanatory texts on larger screens.

plurals
  1. POAngularJS XHR in Mobile Safari spins network indicator forever
    text
    copied!<p>I have a web app running across two subdomains, and all the calls work as they're supposed to. The problem is that when I make a cross-subdomain XmlHTTPRequest, in Mobile Safari the network indicator (in the status bar) spins forever, regardless of the request's success. If I make the request on my local subdomain, the indicator stops when the call returns.</p> <p>I'm using AngularJS to do my XHR work. This code works as I expect:</p> <pre><code>$http( {method: "GET", url: "http://my.domain.com"} ).success (data) -&gt; console.log "success " + data .error (data, status) -&gt; console.log status + " " + data </code></pre> <p>but if I do this: </p> <pre><code>$http( {method: "GET", url: "http://other.domain.com"} ).success (data) -&gt; </code></pre> <p>then the network indicator spins forever. It seems to complete correctly in desktop Safari (as far as I can tell). Nothing in the Web Inspector indicates that any calls are pending - I can see the data returned, and my app receives all the callbacks. In Chrome (both iOS and desktop) the network indicator stops spinning as expected.</p> <p><strong>Edit</strong></p> <p>I filed a bug with Apple. They closed it for "insufficient information" but never asked for more information. I could repro with iOS 7 or 6.1, but in iOS 6.0 the network spinner stopped as expected. That strongly suggests it's an Apple bug.</p> <p>I repro'd without Angular, as well:</p> <pre><code>&lt;script type="text/javascript"&gt; xhr = new window.XMLHttpRequest(); xhr.onreadystatechange = function() { console.log("ready state changed to " + xhr.readyState); if (xhr.readyState == 4) { console.log("HTTP status " + xhr.status); } }; xhr.open("get", "//my.domain.com", true); xhr.send(); &lt;/script&gt; </code></pre> <p>Again, if the request is instead to <code>//other.domain.com</code>, where "other" is a different subdomain than where the script/HTML is hosted, then the network spinner runs forever.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload