Microsoft KB Archive/199805

= PRB: Forward and Back Button Behavior in Internet Explorer =

Article ID: 199805

Article Last Modified on 5/18/2007

-

APPLIES TO


 * Microsoft Internet Explorer 5.0
 * Microsoft Windows Internet Services (WinInet)

-



This article was previously published under Q199805



SYMPTOMS
As of Internet Explorer 5, the browser does not refresh pages when the Forward and Back buttons are used. Pages accessed through the navigation history stack are always pulled from the cache.



CAUSE
The behavior of Back and Forward was changed to conform to section 13.13 of the HTTP 1.1 specification, which states the following:

User agents often have history mechanisms, such as "Back" buttons and history lists, which can be used to redisplay an entity retrieved earlier in a session.

History mechanisms and caches are different. In particular history mechanisms SHOULD NOT try to show a semantically transparent view of the current state of a resource. Rather, a history mechanism is meant to show exactly what the user saw at the time when the resource was retrieved.



STATUS
This behavior is by design.



MORE INFORMATION
The Web server is only contacted if the page file is not in the cache. Expiration headers from the server will have no affect over this behavior, as described in the HTTP 1.1 specification.

For static files, this is almost always the desired behavior. If the file content is not changing on the server, then it improves Internet Explorer's performance greatly to never contact the server for those files when the back and forward buttons are used.

For dynamically generated files, however, problems in Web site applications can often erupt if the user is unaware that the file or page is stale when using the Back or Forward buttons to navigate through pages on a site. This is particularly bad when the dynamic pages use HTML forms to interact with server side processes.

For these dynamic files, Web servers should include the HTTP 1.1 "Cache-Control: no-cache" header in the HTTP response as described in the HTTP 1.1 recommendation to prevent the file from caching. Here is an example ASP page that will not be cached by Internet Explorer 5.0: <%@ Language=VBScript %> <% ' The following line is the important part: Response.CacheControl = "no-cache" Response.AddHeader "Pragma", "no-cache" %> 

This page is using "Cache-Control: no-cache." This page should not be cached for any reason whatsoever. Access to the page via the Back button should pull the page back from the server.

 Current Time: <%= Now %>   The "Pragma: no-cache" header is not essential but is recommended to prevent caching problems involving proxy servers and older versions of Internet Explorer.

Note that it is essential to use HTTP Headers instead of META HTTP-EQUIV tags. META tags are not evaluated until after downloaded files have already been stored in the cache.

