Youre right, they may not explicitly log off. And you are right that you need to handle the occasion that they go away without saying anything to you.
But you shouldn't be worried about the occasion that this happens. You should be handling it with an entirely different paradigm. But being able to successfully detect a browser close isn't enough to solve this problem. Here's what I mean: The browser could stay OPEN. The user could be at lunch, or gone home for the night or weekend. Hours later, are you going to be letting the cleaning crew loose inside of your app? What happens if he has 3 windows open in 4 different web applications and shuts down the computer? Shouldn't all those webapps get notified so they can shut down the session? What sort of mechanism in the browser would do such a thing? Here's a good one: What happens if the user's browser window becomes slow? Say he clicks on "Open a New Window", creating a copy of the same screen inside of your application, and closes the original browser window so as not to have two of them up? This means he effectively "tells you the lie" that he's gone away. Would you throw away all the session information about a user who is still inside of the app? Seem what youre wanting is the browser to tell you about things that happen outside of your application. Don't attempt it. No way. No how. The browser is a dumb thin client. It only knows to tell you what you tell it to say. Youre wanting thick client functionality on the browser, which you would have to implement via an applet or some such. This is just asking for trouble. You can't control the horizontal and the vertical in a browser. Accept this limitation and design accordingly. Seriously, this is a path well traveled. If the user doesn't do anything for a certain amount of time, make him log in again. You don't know what happened to him. Don't keep resources open just for him. If youre doing that, then you've got design issues. HTH -Joe > -----Original Message----- > From: ksitron [mailto:[EMAIL PROTECTED] > Sent: Saturday, June 19, 2004 9:06 PM > To: Struts Users Mailing List > Subject: Re: Detecting browser close > > > > Thanks for the reply. But, I find it hard to accept that it > can't be done. And, users may not be computer savy or follow > good etiquette and log off. > > Bill Siggelkow wrote: > > > AFAIK this cannot be done -- your best bet is to provide a > Logoff link > > and a reasonable session timeout. > > > > ksitron wrote: > > > >> > >> Is there a way to detect when the user closes the browser. What I > >> want to do is do clean-up and destroy the session. > >> > >> > >> Thanks in advance. > >> > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- > > Kevin J Citron > Sr. Object Imagineer > Optimized Objects, Inc. > EL Paso, Texas 79930 > (915) 565-7785/566-2403 > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]