I am resurrecting this thread because I also having this issue.
I do not have this issue in the browser on the desktop, in safari on ios or in Adobe Shadow. But when I run my code in phonegap I never get readystate change events for progress or completion if the server responds with 401.
Originally I was testing this with jquery an thought I was doing something wrong. But I switched to just straight xmlhttpRequest with a watcher for ready state change.
auth = Base64.encode(email + ":" + password)
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = () =>
alert(xmlhttp.readyState)
if xmlhttp.readyState == 4
alert(xmlhttp.status)
xmlhttp.open('GET', @url + "login/", true)
xmlhttp.setRequestHeader("Authorization", "Basic " + auth );
xmlhttp.send()
If the credentials are valid, then everything proceeds just fine (I get alerts for 1,2,4). However if the credentials are invalid, I get an alert for 1 and never again. The ui is not locked but we never get completion events. If I change the async flag on open to false, then I do get all the correct events, but the UI is locked.
I'd think this was a UIWebView bug, but this code runs fine in Safari on the phone as well as in Adobe Shadow, which is a native app that wraps UIWebView (i expect). So the issue is only present when running this code inside phonegap.
Any suggestions? Is this a bug or am I making some wrong assumptions about how things should work?
sim