Bookmark Topic Watch Topic
  • New Topic

How to invaliddate session when browser Window is closed using [x] button

 
Mahesh cosmolite
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 9
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 81
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
This has been discussed dozens of times. Please SearchFirst.
 
    Bookmark Topic Watch Topic
  • New Topic