This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Back / Refresh button in browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Back / Refresh button in browser" Watch "Back / Refresh button in browser" New topic
Author

Back / Refresh button in browser

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi all,

I dont know where this post should belong to...

In my online bank account, i have seen that..

when i try to go back (using browsers back button ) / click refresh,

the application takes me the login page...and says that u have either

used the refresh/back buttons...and should relogin

But how is that the application is able to track these events..

I tried this in IE6 / opera 8 and got the same result.The site pages are in .jsp's.

Would be appreciable if anyone can provide some light...on this..

Regards
A Kumar
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18542
    
  40

The answer probably won't make much sense to you, since it requires a knowledge of HTML (or JSPs)... but...

Quite simply, it is not tracking your refresh or back buttons presses on your browser. It is using sessions (and/or cookies) to track the state of what you are trying to do. And hitting refresh or back is distrupting the session state -- which is why it is complaining and asking you to relogin.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi Henry...

Thank you for the reply...

I do think that i have a fair bit of an idea about the html and jsp..

So if you can elaborate the concept further....I would be happy ...and would try to understand the concept

Thank you...
[ January 31, 2006: Message edited by: A Kumar ]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18542
    
  40

The webpage is either using url rewriting or cookies to maintain a session -- it is basically an id that was created for you on the server side.

This id was created when you logged in, and probably points to a state of the session. So when you make a request, the session, the html request, and everything else (post or get) is sent to the server. If the webpage, and data of your request, is for some session, whose state is supposed to be someelse, it won't work.

Since there should be no way for you to get the state out of sync with the links, it merely assumes that you press back or refresh.


Personally, I think it is just bad programming. Web apps should be written to withstand some amount of back, and definitely refresh.

Henry
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60789
    
  65

Moved to the Servlets forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi..

Thank you...guys...for the info..

Regards
 
wood burning stoves
 
subject: Back / Refresh button in browser
 
Similar Threads
refresh problem
session invalidate
html:multibox problem
Restart a Swing Application from within
Disabling Back and Refresh/Reload button.