iOS6 network activity spinner and CORS
TL;DR;
iOS6 will keep the network activity spinner around forever, with no fix, if you do a CORS ajax request at any time with preflight the network activity spinner will stay until the tab is closed.
So when iOS6 came out there was a few issues with XHR requests making the network activity spinner appear and never go away even though there was no data being requested. There are fixes for this behaviour which involves only triggering XHR request after page load. However I have experienced a variation of this bug that has no fix!
CORS and preflight
When doing CORS requests if you do certain things like use a method other than GET or POST or send custom headers a preflight request will trigger as an OPTIONS request to find out whether it’s safe to continue. On a mobile app I worked on we noticed that the network activity spinner would always show and never go away in iOS6. I reduced my test case down to eventually figure out that any CORS request that triggers a preflight will cause the network activity spinner to show and never go away until the tab is closed in the browser. It also doesn’t matter when the request is triggered.
Test case
I’ve created a simple test case that does a CORS request which sets a custom header, X-Request-With. Someone else also came across this issue and has posted their details on stackoverflow.
View live demo Download the source files
iOS7
I’ve just downloaded the iOS7 beta and this issue still persists. Hopefully this gets some attention before iOS7 ships the final release. I’ve filed a bug with Apple and posted it on the public openradar tracker.