jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to disable session using javascript" Watch "how to disable session using javascript" New topic

how to disable session using javascript

ashishagarwal agarwal

Joined: May 04, 2006
Posts: 4
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?

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

Joined: Feb 05, 2001
Posts: 17276

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


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

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] [About Bear] [Books by Bear]
Ben Souther

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
It's not a secret anymore!