You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sm...@tcs.com on 2004/06/21 13:01:56 UTC

Re: Detecting browser close(ksitron [mailto:ksitron@elp.rr.com])





Hi
    If u r working with Internet Explorer then try this code

<script>
window.onunload=onClose;

function onClose() {
    var retVal;
    if(window.screenTop>10000) {
         alert("Closing the window");
    }
}



</script>

by clicking the close button on the top right corner, rightclicking and
selecting the close from taskbar,pressing alt+f4 this function onClose will
be called.
then from there u can submit the page and then u can invalidate the session
in the Action class

i havn't checked this on other browser's

hope this will help u
ForwardSourceID:NT0