This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes how to disable session using javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to disable session using javascript" Watch "how to disable session using javascript" New topic
Author

how to disable session using javascript

ashishagarwal agarwal
Greenhorn

Joined: May 04, 2006
Posts: 4
Hello,
I need to expire the session whenever anyone closes the window without signout.

I know I can not use java (session) object in javascript functions.

Can I use AJAX ? if yes can you send me some sample application?

Thankyou
Ashish Agarwal
Satish SN
Ranch Hand

Joined: Apr 19, 2005
Posts: 70
Hi Ashish,

i think u can handle it through javascript

u can write a function on the window close event and call a servlet/jsp through which u can invalidate the user session.

try this out i think it should work


Satish SN<br />SCJP 1.4 & SCWCD 1.4
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I am going to move this to the Servlets forum, and hopefully that is the best forum for you question.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

There is no way to reliably detect the closing of the browser. Please see the many posts on this topic already in the HTML forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This topic is also disussed frequently in this and the JSP forums.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to disable session using javascript
 
Similar Threads
Timeout validation dialog box.
Releasing HTTP session state
How session Info is sent to JavaScript (Client) here?
Value from select element is null in request
HttpSessionListener: What were they thinking?