Does the browser Back button send request to web server?

Discussions

Web tier: servlets, JSP, Web frameworks: Does the browser Back button send request to web server?

  1. Hi,

    When a client click the Back button on the browser, does it send a request to server?

    Any answer is appreciated!

    Steven
  2. No it does not unless your cache is turned off. Depends on the browser.
  3. no...
  4. No. The back button does not send request to the webserver. Rather it loads the previous page from the history.
  5. You can prevent a page being added to the cache by setting the response headers on the HTTP Response before you send the page to the browser.

    Try:

    <meta http-equiv="pragma" content="nocache">.

    This should prevent the browser from adding the page to the cache and ensure that any request for that page (including a 'back') will result in a round trip to the server.

    Andy
  6. Hi Andy,

    Does this mean that a servlet/jsp is needed to deal with the Back button if <meta http-equiv="pragma" content="nochache"> is included in the web page? If so, which servlet or jsp will be invoked by web server? The one which creates the nocached web page?

    Thanks,

    Steven
  7. The browser would just back to the same URL as the last page.

    Note that using the nocache pragma doesn't always work. IE in particular is notorious for ignoring no-cache instructions because "it knows best".