RE: Detecting browser close

2004-06-22 Thread Guillermo Meyer
We are detecting when the user closes the browser window with this
javascript (only in IE with JS enabled):


function logoff() {
if (document.all) {
// IExplorer
if (window.screenTop > 9000) {
// window closed
top.location="<%=request.getContextPath()%>/logoff.do";
//get the logoff action
} else {
// window refreshed
}  
}
}





Hope this help.
Cheers.
Guillermo.

-Original Message-
From: Frank Zammetti [mailto:[EMAIL PROTECTED] 
Sent: Lunes, 21 de Junio de 2004 01:03 p.m.
To: [EMAIL PROTECTED]
Subject: RE: Detecting browser close


It was my understanding that only signed scripts could open popups 
off-screen, or of too small a size (I think 100px in either direction).

I use the approach you outline as well, although it's not critical that
the 
user logs out of my app anyway but they do feel good about having an 
explicit logout button.  I however pop up a small "now logging out"
message 
for them in the new window, partly because I think that's perhaps nicer
to 
show that what they asked to happen actually did, but also because an 
off-screen popup wasn't allowed.

Just curious how you got the off-screen popup to work without a signed 
script (assuming you didn't have one?).


>From: "Joe Hertz" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Subject: RE: Detecting browser close
>Date: Mon, 21 Jun 2004 11:56:56 -0400
>
>This is fine if you want to provide a popup window to the user. This 
>still isn't an authoritative way of determining if the user has "logged

>out".
>
>Your app should never depend on the client's PC having electricity.
>
> > -Original Message-
> > From: Simone - Dev [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, June 20, 2004 6:48 AM
> > To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
> > Subject: R: Detecting browser close
> >
> >
> > What I'm proposing to you it's a solution that works only on JS 
> > enabled browsers, but since this is almost the 99,99% of the browser

> > on the market shouldn't be a problem :-)
> >
> > On the onClose event of the window object (javascript object) opens 
> > a new window of 10px that is displayed off the screen (8000px left):

> > this windows will contain a page that close all session specific 
> > resources as soon as the user exit, without having to wait the 
> > session timeout to expire
> >
> > I used it many times, also to provide a "u forgot to save what you 
> > did, are you sure you want to exit the page?" alert (but this need a

> > onBeforeClose event that is available only on IE).
> >
> > Simone
> >
> > -
> > Simone Chiaretta
> > www.piyosailing.com/S
> > Any sufficiently advanced technology is indistinguishable from magic

> > "Life is short, play hard"
> >
> >
> > > -Messaggio originale-
> > > Da: ksitron [mailto:[EMAIL PROTECTED]
> > > Inviato: sabato 19 giugno 2004 23.32
> > > A: Struts Users Mailing List
> > > Oggetto: Detecting browser close
> > >
> > >
> > >
> > > 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]
> > >
> >
> >
> > 
> > -
> > 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]
>

_
MSN 9 Dial-up Internet Access fights spam and pop-ups - now 3 months
FREE! 
http://join.msn.click-url.com/go/onm00200361ave/direct/01/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PR

Re: Detecting browser close(ksitron [mailto:ksitron@elp.rr.com])

2004-06-21 Thread smuthu . subramaniam





Hi
If u r working with Internet Explorer then try this code


window.onunload=onClose;

function onClose() {
var retVal;
if(window.screenTop>1) {
 alert("Closing the window");
}
}





by clicking the close button on the top right corner, rightclicking and
selecting the close from taskbar,pressing alt+f4 this function onClose will
be called.
then from there u can submit the page and then u can invalidate the session
in the Action class

i havn't checked this on other browser's

hope this will help u
ForwardSourceID:NT0

DISCLAIMER: The information contained in this message is intended only and solely for 
the addressed individual or entity indicated in this message and for the exclusive use 
of the said addressed individual or entity indicated in this message (or responsible 
for delivery
of the message to such person) and may contain legally privileged and confidential 
information belonging to Tata Consultancy Services. It must not be printed, read, 
copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person 
other than the addressee. 
Unauthorized use, disclosure or copying is strictly prohibited and may constitute 
unlawful act and can possibly attract legal action, civil and/or criminal. The 
contents of this message need not necessarily reflect or endorse the views of Tata 
Consultancy Services on any subject matter.
Any action taken or omitted to be taken based on this message is entirely at your risk 
and neither the originator of this message nor Tata Consultancy Services takes any 
responsibility or liability towards the same. Opinions, conclusions and any other 
information contained in this message 
that do not relate to the official business of Tata Consultancy Services shall be 
understood as neither given nor endorsed by Tata Consultancy Services or any affiliate 
of Tata Consultancy Services. If you have received this message in error, you should 
destroy this message and may please notify the sender by e-mail. Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: Detecting browser close

2004-06-21 Thread Frank Zammetti
It was my understanding that only signed scripts could open popups 
off-screen, or of too small a size (I think 100px in either direction).

I use the approach you outline as well, although it's not critical that the 
user logs out of my app anyway but they do feel good about having an 
explicit logout button.  I however pop up a small "now logging out" message 
for them in the new window, partly because I think that's perhaps nicer to 
show that what they asked to happen actually did, but also because an 
off-screen popup wasn't allowed.

Just curious how you got the off-screen popup to work without a signed 
script (assuming you didn't have one?).


From: "Joe Hertz" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: Detecting browser close
Date: Mon, 21 Jun 2004 11:56:56 -0400
This is fine if you want to provide a popup window to the user. This
still isn't an authoritative way of determining if the user has "logged
out".
Your app should never depend on the client's PC having electricity.
> -Original Message-
> From: Simone - Dev [mailto:[EMAIL PROTECTED]
> Sent: Sunday, June 20, 2004 6:48 AM
> To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
> Subject: R: Detecting browser close
>
>
> What I'm proposing to you it's a solution that works only on
> JS enabled browsers, but since this is almost the 99,99% of
> the browser on the market shouldn't be a problem :-)
>
> On the onClose event of the window object (javascript object)
> opens a new window of 10px that is displayed off the screen
> (8000px left): this windows will contain a page that close
> all session specific resources as soon as the user exit,
> without having to wait the session timeout to expire
>
> I used it many times, also to provide a "u forgot to save
> what you did, are you sure you want to exit the page?" alert
> (but this need a onBeforeClose event that is available only on IE).
>
> Simone
>
> -
> Simone Chiaretta
> www.piyosailing.com/S
> Any sufficiently advanced technology is indistinguishable
> from magic "Life is short, play hard"
>
>
> > -Messaggio originale-
> > Da: ksitron [mailto:[EMAIL PROTECTED]
> > Inviato: sabato 19 giugno 2004 23.32
> > A: Struts Users Mailing List
> > Oggetto: Detecting browser close
> >
> >
> >
> > 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]
> >
>
>
> -
> 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]
_
MSN 9 Dial-up Internet Access fights spam and pop-ups – now 3 months FREE! 
http://join.msn.click-url.com/go/onm00200361ave/direct/01/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Detecting browser close

2004-06-21 Thread Joe Hertz
This is fine if you want to provide a popup window to the user. This
still isn't an authoritative way of determining if the user has "logged
out".

Your app should never depend on the client's PC having electricity.

> -Original Message-
> From: Simone - Dev [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, June 20, 2004 6:48 AM
> To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
> Subject: R: Detecting browser close
> 
> 
> What I'm proposing to you it's a solution that works only on 
> JS enabled browsers, but since this is almost the 99,99% of 
> the browser on the market shouldn't be a problem :-)
> 
> On the onClose event of the window object (javascript object) 
> opens a new window of 10px that is displayed off the screen 
> (8000px left): this windows will contain a page that close 
> all session specific resources as soon as the user exit, 
> without having to wait the session timeout to expire
> 
> I used it many times, also to provide a "u forgot to save 
> what you did, are you sure you want to exit the page?" alert 
> (but this need a onBeforeClose event that is available only on IE).
> 
> Simone
> 
> -
> Simone Chiaretta
> www.piyosailing.com/S
> Any sufficiently advanced technology is indistinguishable 
> from magic "Life is short, play hard"
> 
> 
> > -Messaggio originale-
> > Da: ksitron [mailto:[EMAIL PROTECTED]
> > Inviato: sabato 19 giugno 2004 23.32
> > A: Struts Users Mailing List
> > Oggetto: Detecting browser close
> > 
> > 
> > 
> > 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]
> > 
> 
> 
> -
> 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]



Re: Detecting browser close

2004-06-20 Thread Pedro Salgado
On 04/06/20 3:49, "mike" <[EMAIL PROTECTED]> wrote:

> There are ways, if you are so adamant about this that you want to use a lot
> of resources.  Are you?
> 
> At 04:53 PM 6/19/2004, 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.
>>> 

  This will help you clean-up and destroy the session. If you already know
how to accomplish this... Then skip this reply... :)



  I don¹t know the objective you want to accomplish but I had to implement a
UserContainer that was session aware.
  All I had to do is implement the HttpSessionBindingListener on this class.

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/javax/servlet/htt
p/HttpSessionBindingListener.html


  By default, when you destroy the session all attributes are destroyed but
not closed (example: a database connection may still persist but the session
itself doesn't).

  The best way to clean-up/close resources is to define a
ApplicationContainer with a

"private Map map = new HashMap();"

 and then implement something similar to HttpSession

"public final void setAttribute(final String key, final Object value)"
"public final getAttribute(final String key)"

and the 

"public void valueUnbound(HttpSessionBindingEvent event)"

you could also implement this method

"public void valueBound(HttpSessionBindingEvent event)"

to initalize container's configurations/resources.

When a user logs off you just to remove the ApplicationContainer from
session and the unbound method will be called.
When a session times out the ApplicationContainer will be removed from
session and the unbound method will be called.


Pedro Salgado


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Detecting browser close

2004-06-19 Thread Joe Hertz
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]



Re: Detecting browser close

2004-06-19 Thread mike
There are ways, if you are so adamant about this that you want to use a lot 
of resources.  Are you?

At 04:53 PM 6/19/2004, 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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Detecting browser close

2004-06-19 Thread ksitron
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]


Re: Detecting browser close

2004-06-19 Thread Bill Siggelkow
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]