Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Handle REFRESH event in Browsers?

 
M K Rayapudi
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
manoj r patil
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you serious? Log someone out if refresh is clicked? Why would you want to do that?
 
M K Rayapudi
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Bear Bibeault for your immediate response.
I will go through the article you suggested.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic