Trap the window close event
I am facing the problem to logout my page. I 开发者_StackOverflow中文版calls the logout method from the tag of the page like this
<body onbeforeunload="beforeLogout();" onUnload="logout('/ruxamod/faces/zzrucmpvhs1.xhtml?logout=t');" onclick="hideDescFrame();">
but I have no idea how to trap the window close button is clicked because all these methods are call when user refresh the page.
Thanks
I have no idea how to trap the window close button is clicked
As far as I know, there is no way to do this. You can't find out the reason why the document is getting unloaded.
You may be able to catch this by frequently polling from the opener document whether the window is still open.
Alternatively, you could consider using an inline dialog like jQuery UI dialog where you can catch all events.
精彩评论