title: How to prevent iframe affecting browser history
body: <p>I'm encountering a browser history issue when working on a web project.</p>
  
  <p>Theres an iframe in my page, which I would change its <code>src</code> value using Javascript.
  The whole thing works just fine except this change of src would affect the browser history.</p>
  
  <p>I do not want to push the browser history, when I change the iframe url.
  I'm expecting that the user would leave the whole base page and go to the previous location when clicking on the back button, rather than just going back on the changed iframe.</p>
  
  <p>What I've tried:</p>
  
  <ul>
  <li>remove the former iframe, and replace with a new one having the new <code>src</code> value</li>
  <li>use <code>replaceWith()</code> method from jQuery</li>
  <li>use <code>iframe.contentWindow.location.replace()</code> to replace the iframe location</li>
  </ul>
  
  <p>Both methods above behaved nothing different than just changing the <code>src</code> directly on my Safari browser. The back button is still affected.</p>
  
  <p>Haven't tested yet on other browsers, but I assume other webkit browsers would be the same.</p>