0

I have tried a lot of things for onbeforeunload and came up with a solution-

window.addEventListener("beforeunload", function(e) {
    (e || window.event).returnValue = null;
    return null;
});

This seems to work when i navigate away from the current page inside the application, but its not working for which it is intended that is on browser close. i want this to work only on browser close and not on navigating by clicking on other links inside the application. Any leads will be appretiated. Thanks in advance.

Krupesh Kotecha
  • 2,396
  • 3
  • 21
  • 40

0 Answers0