0

In IE I used the following AJAX callback in the beforeunload event handler. Now using MS Edge the AJAX will not fire.

window.addEventListener("beforeunload", function(event) {
    stopTimer();
    $.post("/LabelPrintingWebApp/InitialControllerServlet",
    {lifecycle:"filecleanup",
    source:0},'json');
});
Steve Dyke
  • 155
  • 3
  • 14
  • Are you certain that your function is being called? I tested a bit and found that if there has been no user interaction on the page then the function is not called in Edge, but is in IE11. The answer from @MarekWysmułek at [link]https://stackoverflow.com/questions/24081699/why-onbeforeunload-event-is-not-firing discusses the issues. – A Haworth Dec 23 '20 at 17:08
  • @AHaworth so you were able to get MS Edge to fire an AJAX callback if the page was interacted with? – Steve Dyke Dec 23 '20 at 18:04
  • I didn’t try that, but I did see that it had entered the function. – A Haworth Dec 23 '20 at 18:27

0 Answers0