I've noticed some strange behavior in google chrome:
- if we send post ajax request when there is no network connection, we get err_internet_disconnected exception in console (and I think, it's OK)
- if we send long post ajax request and lose network connection during this request, google chrome doesn't abort it, there is no err_internet_disconnected exception in console and in devconsole's network tab this request is marked as pending (even after connection appear). In fact, this connection hangs and there is no opportunity to process this in js code (we expect to get ajax error, but nothing happens).
Have you any suggestions how to deal with this behavior?
EDITED: a sample of code:
$.ajax({
url: "https://someserver.com/ws.asmx/ExecuteEx?pureJson",
type: "POST",
contentType: "application/json",
data: data,
success: function() {
console.log("success");
},
error: function() {
console.log("error");
}
})
I tried this code in chrome dev console in this page while editing this post. Screenshot is below. The first request is my. I sent it, then unplugged network cable. The second request was failed (because of unplugged network cable). Then i plugged in network cable and the third request was successful. But the first request still has pending status (despite the loss of network connection).