I notice strange behavior with Internet Explorer when my page is inside an iframe. It seems that the iframe is being reloaded when window.history.back () is called, although only the hash in the url should change. When the page is not inside the iframe, it behaves correctly and does not reload the page. Any idea why this is happening and how to prevent it?
I created a script that will demonstrate this in IE9:
http://jsfiddle.net/peh96/5/
jsfiddle uses an iframe, so the behavior will be iframe behavior. Pressing "#foo" and "#bar" will change the hash in the URL. Now clicking on the BACK link will call window.history.back (). Note that the timestamp changes when you do this, indicating that the page is reloading.
Alternatively, if you load the iframe directly:
http://fiddle.jshell.net/peh96/5/show/
You will notice that the time stamp does not change when you press "BACK".
This is a problem only with IE, since Chrome and Firefox are compatible with inside the iframe or not.
Any idea how to prevent this reboot?
source share