Steps to reproduce
This issue applies to at least IE11 and Edge.
What steps will reproduce the problem?
(1) Unzip the attachment, open index.html. The number above and inside the iframe should be equal
(2) Hit reload a few times, observe that the numbers are still equal.
(3) Hit the back button a few times. The numbers can suddenly be out of sync
What is the expected result?
The numbers above and inside the iframe should always be the same
What happens instead?
They are not. This is very surprising to me because if you inspect the DOM, you will see that the iframe src is set to the correct document, but it is displaying the content of a different document. When you set a breakpoint in script.js, you will also see that the src is set correctly, but the network request is to different url.
I have used document.write to simulate server-side templating. It has no effect on this bug.
Serving all assets via an actual server and setting Cache-Control to “no-cache, no-store, must-revalidate” does not solve this either.
Firefox does not have this issue, whereas Chrome does (https://bugs.chromium.org/p/chromium/issues/detail?id=657317). If the IE back button behaviour were to be correct, please advise me on how I can change the code to force IE to load the correct iframe every time.
Comments and activity
- Microsoft Edge Team
Changed Assigned To to “Ibrahim O.”
Changed Assigned To to “Rick J.”
Changed Assigned To to “Venkat K.”
Changed Assigned To from “Venkat K.” to “Divya G.”
Chrome has replied to their issue https://bugs.chromium.org/p/chromium/issues/detail?id=657317#c8 that this behaviour is an unfortunate side effect of their best-effort approach to restore the session.
They provide a way out by changing the ‘name’ of the iframe. Unfortunately, this does not solve the issue in IE.
Based on this information, I explored ways to disable back navigation caching https://msdn.microsoft.com/query/dev12.query?appId=Dev12IDEF1&l=EN-US&k=k(VS.WebClient.Help.DOM7011).
Specifically, I added a Web Worker. But that also does not solve this issue, the numbers are still out of sync.
Could you please update this issue with a) whether this is a bug / edge case of IE’s implementation and b) whether there is a way to disable the behaviour?