Vaadin Javascript Unload Event Listener Not Firing
I have a Vaadin 7 application where I need to reliably detect a user leaving or navigating away from a page in order to carry out some cleanup. My aim is to have the page pop up a
Solution 1:
I have found the solution to my problem.
I suspect that most of this issue was solved by the solution to my other related issue which involved putting certain parts of code into synchronous methods. After fixing this issue, the unload method worked across most of the browsers I have tested on. However, Chrome was still playing up and would only fire the unload event on browser close, and not on tab close. Adding in a 'pagehide' listener seems to mean that Chrome tab closing is now acting appropriately.
So, a combination of 'unload' and 'pagehide' events seems to work across all browsers, and (as of now for me) appears to be reliable, and my cleanup is always performed when the user leaves the page.
Post a Comment for "Vaadin Javascript Unload Event Listener Not Firing"