Sharovatov’s Weblog

HTTP History Lists and Back Button

Posted in browsers, http by sharovatov on 3 June 2008

While writing the post about forms values persistence, I noticed that browsers handle back button in different HTTP situations differently.

HTTP 1.1 spec says the following:

13.13 History Lists

 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.

 By default, an expiration time does not apply to history mechanisms.
 If the entity is still in storage, a history mechanism SHOULD display
 it even if the entity has expired, unless the user has specifically
 configured the agent to refresh expired history documents.

 This is not to be construed to prohibit the history mechanism from
 telling the user that a view might be stale.

So it clearly recommends UA authors to separate history list and cache behaviour. So if user navigates through the history list (using Back or Forward buttons), HTTP spec recommends to show the exact response that the user saw before, regardless if it's stale or expired.

I've tested 4 major browsers — IE, FF, Opera and Safari, and here is the summary table:

Expires in the future +
Conditional GET validators
no request no request no request no request
Expires in the future no request no request no request no request
Conditional GET validators no request no request no request no request
no HTTP caching headers no request no request no request full request
Expires in the past no request no request no request full request
Cache-Control: no-store full request full request no request full request
Cache-Control: no-store +
Expires in the past
full request full request no request full request
Page served with IE8 FF Opera Safari

So we can see that only Opera follows HTTP 1.1 recommendation.

Obviously IE and FF don't produce a request when HTTP caching is not explicitly prohibited which is against the HTTP spec recommendation, but this was done intentionally asauthors usually prohibit caching for a reason and don't want users to view those pages without revalidating.

And Safari just does the full request whenever the page is not cached explicitly.

Tagged with: , , , ,
Follow

Get every new post delivered to your Inbox.