1

I read this and it is working fine

window.addEventListener('beforeunload', function (e) {
    e.preventDefault();
    e.returnValue = '';
});

But if the document load is not yet completed, this one is not working. Is there a way to detect browser closing before page full loading, i.e. before DOMContentLoaded

Hasan A Yousef
  • 19,411
  • 21
  • 113
  • 174

0 Answers0