• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to identify a window close and a window refresh event

 
Rohit Rai
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I have been looking around but could not get any idea as to how to differentiate between a close event and refresh event using JavaScript. As the onUnload event is called both the time. i.e. if the user closes the window and also if he/she refreshes it.
Any idea as to how to go about?

Regards,

Rohit
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way to do it.

Eric
 
Rohit Rai
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric !

Yup I think so.

Regards,

Rohit
 
suresh dasari
Ranch Hand
Posts: 121
Chrome Eclipse IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, I am trying to achieve the same thing, but couldnt do it.

any help is appricieated.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As has already been said, it cannot be done. It doesn't matter how badly you need it.
 
suresh dasari
Ranch Hand
Posts: 121
Chrome Eclipse IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I fount a partial solution.
I mean refresh can be done in 2 ways
1) clicking F5 button
2) browsers refresh button.

I found solution for F5 button.
but browsers refresh is pending.

any ways my requirement is only F5 because we is hiding the browser refresh button.
 
Georgiana Lungu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have noticed that if a bean instantiated in the page we want to check for refresh, then, if a page is opened for unload, in that page request.getAttribute("bean_name"); returns null if browser with the first page was closed and returns not null if the browser was just refreshed. Please correct me if i am missing somethign.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do server-side beans have to do with JavaScript events?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic