aspose file tools*
The moose likes JSP and the fly likes How to Handle REFRESH event in Browsers? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to Handle REFRESH event in Browsers?" Watch "How to Handle REFRESH event in Browsers?" New topic
Author

How to Handle REFRESH event in Browsers?

M K Rayapudi
Ranch Hand

Joined: Feb 19, 2007
Posts: 157
Dear Ranchers,
My application has a login page, after successful login user can view or navigate to several pages .
My requirement is when ever the user clicks REFRESH button from the BROWSER, Session should expire and needs to show Login Page.
How to handle REFRESH event in browsers? Is it(handling) different for different browsers?
Please help in this regard.


R6i
manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 181
Your question is not clear to me.

Each session has time out and default value is 30 min. So if you are validating the session on each page, for invalid session, you can throw the user to login page, in this case it has nothing to do with refresh event of browser as such.


love your job and not your company;
...because you never know when your company will stop loving you!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61612
    
  67

Are you serious? Log someone out if refresh is clicked? Why would you want to do that?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
M K Rayapudi
Ranch Hand

Joined: Feb 19, 2007
Posts: 157
thank you Manoj and Bear Bibeault for your immediate response.
Bear Bibeault wrote:Are you serious? Log someone out if refresh is clicked? Why would you want to do that?

Yes, I need this functionality, I am working on E-Commerce module, in order to stop multiple submits by the user by REFRESH button, I require this.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61612
    
  67

Logging off is hardly the appropriate way to handle multiple submits. Would you also chop off your head to cure a headache?

Read through this article and pay particular attention to the P-R-G pattern.
M K Rayapudi
Ranch Hand

Joined: Feb 19, 2007
Posts: 157
thank you Bear Bibeault for your immediate response.
I will go through the article you suggested.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

This is related to the perenial FAQ: How do I disable browser back and forward buttons.

It does have a FAQ entry:http://faq.javaranch.com/java/InterfaceDesignersRule1
 
jQuery in Action, 2nd edition
 
subject: How to Handle REFRESH event in Browsers?