Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to handle window closing event.

 
Nilabhra Banerjee
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 121
Chrome Eclipse IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neil,

could you please explain it more clearly?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic