We are binding global ajax handlers to check if the browser went offline :
$(document).ajaxSend(function(event, xhr, settings, response){
if(!navigator.onLine){
xhr.abort();
}
}
then we are showing a dialog to the user that the browser went offline and bind for the ‘online’ event to hide the dialog when the browser turns online again.
Is there Anyway (even a hacky one) to restart the Ajax request based on the old which fits in the old context?
Here’s the cleanest approach I can think of:
A conditional in the
ajaxSend()handler that either pushes the calls on the queue for later or executes the entire queue.