views:

1252

answers:

2

I'm changing an IFRAME's src in order to reload it, its working fine and firing the onload event when its HTML loads.

But it adds an entry to the history, which I don't want. Is there any way to reload an IFRAME and yet not affect the history?

+6  A: 

You can use javascript location.replace:

window.location.replace('...html');

Replace the current document with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it.

Greg
Would'nt this target the page itself? I only want to reload the IFRAME and I've no control over the scripts running inside the loaded document.
Jenko
Just replace "window" with a reference to your iframe.
Ishmael
Its not that simple!
Jenko
Why is it not that simple? var ifr = document.getElementById("iframeId"); ifr.location.replace(ifr.src);
epascarello
A: 

You might be interested in this: http://developer.apple.com/internet/webcontent/iframe.html

Marco Demajo