PRB: Forward and Back Button Behavior in Internet Explorer

ID: Q199805


The information in this article applies to:
  • Microsoft Internet Explorer (Programming) version 5.0


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"
%>
<HTML><BODY>

<P>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.</P>

<P>
Current Time:
<%= Now() %>
</P>
</BODY></HTML> 
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.


REFERENCES

See section 13.13 of Revision 5 to HTTP 1.1 proposed standard:

http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-rev-05.txt
For more information on Internet Explorer 5's object model support for persistence behaviors, see the DHTML Persistence documentation on the MSDN Online Web Workshop:
http://msdn.microsoft.com/workshop/author/persistence/overview.asp
For additional information about Forward and Back button behavior, click the article number below to view the article in the Microsoft Knowledge Base:
Q229684 Back Button in Internet Explorer Becomes Unavailable

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Jason Strayer, Microsoft Corporation

Additional query words:

Keywords : kbWinInet kbGrpInet kbIE500 kbCaching kbDSupport kbIEFAQ
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: February 1, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.