| Author |
how to invoke a function in javascript on closing the browser window
|
Anand Sivathanu
Ranch Hand
Joined: Jun 25, 2010
Posts: 76
|
|
Hi All,
I would like to know to invoke a function in JavaScript on closing the browser window.I am trying to
invalidate the user's session in JSP when the user unfortunately closes the browser window.
I have tried the following steps
function UnLoad() {
window.alert("on closing");
}
window.onunload=unLoad;
<body onUnload='javascript:UnLoad();'>
but its not working.
Please help me in this issue.
Regards,
Anand Sivathanu
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56232
|
|
This has been discussed many many times before in this forum. Please SearchFirst.
The result is always the same: you cannot be reliably informed when the browser is closed. You must rely upon the session timeout to allow orphaned sessions to be reclaimed.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: how to invoke a function in javascript on closing the browser window
|
|
|