Author
How to invaliddate session when browser Window is closed using [x] button
Mahesh cosmolite
Greenhorn
Joined: Sep 19, 2011
Posts: 1
posted Sep 19, 2011 00:42:24
0
Hi Forum,
I want to invalidate session when browser is closed by end user using [x] button on LHS or double click on RHS.
Regards
Mahesh
Anuj Batra
Greenhorn
Joined: Sep 18, 2011
Posts: 24
posted Sep 19, 2011 01:20:23
0
I do not think there is a cross browser event handler available. but for IE onUnload works.
so place the function <body onUnload="function logout()">
function logout() {
<%session.inValidate();%>
}
jeya velan
Greenhorn
Joined: Feb 07, 2011
Posts: 9
posted Sep 19, 2011 07:21:16
0
Anuj Batra wrote:
function logout() {
<%session.inValidate();%>
}
You can not make a javascript function to execute a scriptlet.
You can call the logout URL using javscript which will do the work.
But you can't be sure.
There is no guarntee that onunload will execute properly.
olivier dutranoit
Ranch Hand
Joined: Aug 20, 2011
Posts: 81
posted Sep 19, 2011 07:42:28
0
let the session timeout do its work.
or put a < a href = ""> url to a logout servlet on the page.
do not try to capture browser events.
bad idea.
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56201
posted Sep 19, 2011 08:07:53
0
This has been discussed dozens of times. Please SearchFirst .
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
subject: How to invaliddate session when browser Window is closed using [x] button