aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to handle window closing event. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to handle window closing event." Watch "How to handle window closing event." New topic
Author

How to handle window closing event.

Nilabhra Banerjee
Ranch Hand

Joined: Mar 17, 2004
Posts: 34
I have an application which has many jsps, one loading after another. I want to capture the closing of the browser window but not loading new content within the window. Is it possible?

I have used body onUnload event, but the event is fired even if the jsp is refreshed by a new jsp.

Thanks and regards
Neil
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
the browser does not know the difference between new links being loaded, closing the window, or refreshing. Only thing you can try is onbeforeunload.

Eric
Nilabhra Banerjee
Ranch Hand

Joined: Mar 17, 2004
Posts: 34
Just musing over my old thread. Yes it can be done. I did it...I kept the windowname in a cookie. The cookie can be expired and recreated every 2 seconds. THe new window opened by the user can then close this window and put focus one the old one.
suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 121

Neil,

could you please explain it more clearly?


Sun Certified Java Programmer with 93 percent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle window closing event.