The "IE back bug"

In certain situations, pressing the "Back" button in Internet Explorer to return to a form causes that form to revert to its initial values.

Affected versions

This problem appears to be fixed in Internet Explorer 8, although bug report for this issue in IE8 (332575) was marked as "Closed (Postponed)".

How to trigger it

The following steps produce the expected result:

  1. Go to a page that contains a form (like this one).
  2. Enter/change values in the form.
  3. Submit the form.
  4. Hit "Back".
  5. No bug: the form values you entered are retained.

But adding one seemingly insignificant step causes the bug:

  1. Go to a page that contains a form (like this one).
  2. Enter/change values in the form.
  3. Make the page call window.open().
  4. Submit the form.
  5. Hit "Back".
  6. Bug: the form fields are reset to their initial value.

Explanation

In the first scenario, the page is read from the cache and displayed.
In the second scenario, the page is re-fetched from the server and re-painted. This can be verified using tools like Ethereal or Fiddler.

The following MS KB articles discuss similar situations, although I don't know if they directly explain why the page is re-fetched:

Workarounds

See the bug for yourself

  1. and hit "Back"
  2. See that the value you entered is still there
  3. and hit "Back"
  4. See that the value you entered is replaced with the initial value

This page is hosted on a free hosting site. Due to reasons beyond my control, it could disappear at any time.
If you keep a collection of IE bugs online, and can handle PHP scripts, please consider adding this one to your collection.
Feel free to modify the page as you see fit. I just want the bug, testcase and workaround(s) to remain documented for everyone.