0

Dear friends I have an issue while trying to catch window.onbeforeunload event in Firefox (version. 47 and more).

The problem is that in Firefox window.onbeforeunload works well when I right click on screen and inside the pop-up menu choose "Reload" option.
Whereas it's not working when I:

  • press F5 or Ctrl + F5 key
  • click on the Reload button in browser's navigation

Here is my code:

window.onbeforeunload = function (e) {
     e = e || window.event;
     self.video_disconnect();

     if (e) {
        e.returnValue = 'Sure?';
     }

     // For Safari
     return 'Sure?';
}; 

By the way, I applied many solutions (also from here: window.onbeforeunload and window.onunload is not working in Firefox , Safari , Opera? and from here: Mozilla firefox not working with window.onbeforeunload ) and have searched a lot, but still could not find the appropriate one.
The solutions provided there seems old so I hope there is already new approach for this issue. Thanks!

Community
  • 1
  • 1
johannesMatevosyan
  • 1,974
  • 2
  • 30
  • 40

0 Answers0