File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Question about back button in browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Question about back button in browser" Watch "Question about back button in browser" New topic

Question about back button in browser

Jane Somerfield
Ranch Hand

Joined: Jul 20, 2002
Posts: 193
When I click the back arrow button in a browser,
the previous page is displayed again.
Where is the "previous" page from? Browser cache or
reloaded from server? Is there a way to disable the back button in
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Last question first: No, you can not disable the back button (thankfully).

Answer to the first question: It depends.
If the page is cached in the browser, you will usually see the cached version.
If not, the browser will make a new request to get the data.

If the data was the result of a request of type POST, the browser will warn the user that the form will be re-submitted in order to recreate the page.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Candi So

Joined: Jun 23, 2006
Posts: 2
Thanks for the insight.

The scenario is that on my form, there's a field which could be populated by a search function written in javascript, or by typing in the value directly. If the value is typed in directly, the Back button will show the form with the value. However, if it's populated by the javascript, the form will be initialized. Actually, if I run it in debug mode, I see that the URL is triggered again, so all the initialization happens again.

The goal is to see the page with the populated value when the Back button is hit. So, my question is how could I do that?

Your help is much appreciated.
I agree. Here's the link:
subject: Question about back button in browser
jQuery in Action, 3rd edition