What you can try is to place the iframe inside the div container:
<div id="iframe-container"> <iframe src="..."></iframe> </div>
Then in your JavaScript create a second iframe , put it back if the first iframe , and then hide the first:
var container = document.getElementById('iframe-container'); var iframe2 = document.createElement('iframe'); iframe2.src = 'http://new.url.com'; iframe2.style.visibility = 'hidden'; container.appendChild(iframe2); container.removeChild(container.getElementsByTagName('iframe')[0]); iframe2.style.visibility = 'visible';
Hope this works, I have not tested it. You will also need to play around with your CSS.
source share