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
  • 22,789
  • 24
  • 132
  • 203

0 Answers0