Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

valueUnbound problem

 
Mike Stan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to figure out how to close a user session when he or she closes the web browser.
The ValueUnbound event is invoked only when session timeout expires.
any ideas??
http://www.wirescale.com/
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oddly enough I just had to deal with this problem myself today. Check out this thread in the HTML/JavaScript forum.
From my code in that thread you can see how to fire off a JavaScript function when the browser is closed or a user navigates off of your site. That JavaScript function opens a new window and points to a servlet/JSP/Struts Action/whatever that does any cleanup you need done and invalidates the session. I use Struts, so I have my struts Action forward to a page that simply closes itself, thus getting rid of the popup you just opened. You can do this by placing on1oad="self.close()" (replace the number 1 with L there, UBB can be a pain sometimes) in your <body> tag.
HTH
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic