How to detect tab/window close event when using the Navigator Add-On?

Hi,

I am currently using the Navigator add-on to support multi-tabs in my application. However, I am having a hard time detecting when the tab/window is closed. I need to execute some clean-up logic when the user exits the tab/window.

Overriding the Window.close or adding a close listener does not work because the close event is also triggered when the new tab is created. Any ideas?

Thanks,
Rowell

The close listener should be called on the unload event of the window, but I guess that event fires when the user leaves the page via link, even if that link is opened into a new tab (might be browser bug).

I would probably try to use either the Refresher add-on or plain ProgressIndicator to determine if the window/tab is still open (polling will stop when the window/tab is closed).

Polling might also be needed because Opera does not send the close events used by Vaadin. This could also be considered a bug, but I’m not sure if it would be possible to resolve without “hidden” polling - I have not looked into it in detail.