Im trying to fire off an AJAX request before a page unloads using the unlaod event and jQuery:
jQuery(window).on("unload", function(event) {
SaveSettings();//makes an ajax request with the 'async' property set to false
});
This works fine in IE9 and FF10, but in the webkit browsers (chrome and safari specifically), the event is called, but the AJAX request is never completed. I am setting jQuery's AJAX call to synchronous (i realise this may "hold up" the browser but it should be quick!). I even tried binding directly to the window.onbeforeunload event, but with the same results. I would think that a synchronous request to a webservice should prevent the browser from closing before the call is complete, right?