Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

window.onbeforeunload not functioning if restore previous session is enabled

  • 1 jibu
  • 1 ana tatizo hili
  • 7 views
  • Last reply by cor-el

more options

I have application script that uses window.onbeforeunload to perform a certain function when the window or tab is closed. This works fine in firefox (and other browsers), but won't work if the restore previous session browser setting is enabled. Any help is appreciated.

I have application script that uses window.onbeforeunload to perform a certain function when the window or tab is closed. This works fine in firefox (and other browsers), but won't work if the restore previous session browser setting is enabled. Any help is appreciated.

All Replies (1)

more options

If you use Restore Previous Session then you aren't leaving the page if you close Firefox because you can resume the next time you open Firefox and you aren't suffering data loss unless the page uses complicated JavaScript that might not make it possible to restore the page. So that might be causing window.onbeforeunload not functioning as expected by you. I don't know whether this is intentionally.