title: prevent an iframe with a page redirect in the frame from being included in browser's back button/history
body: <p>I have an HTML page with an iframe, and the iframe displays a slideshow using HTML pages that load in the iframe. The user can click "Next" or "Back" within the iframe, and the iframe simply loads another HTML page. The HTML pages in the iframe are on the same domain, but in a different directory. I have blocked these clicks from the browsers back button/history by placing the following script in the body of all the pages that load in the iframe, and this part works...</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
      var anchors = document.getElementsByTagName('a');
      for (var i = 0; i &lt; anchors.length; i++) {
      var anchor = anchors[i];
      anchor.addEventListener('click', function(event) {
      history.replaceState(null, null, anchor.href);
      }, false);
      }
      &lt;/script&gt;
  </code></pre>
  
  <p>The problem is that there is also a link within each iframe page called "Autoplay" that loads an identical looking HTML page, except that it has the following script added to the head to make the page redirect after 5 seconds, and the browser's back button/history is capturing the redirects.</p>
  
  <pre><code>    &lt;script type="text/JavaScript"&gt;
      setTimeout(function () {
      window.location.href = "auto2.htm";
      }, 5000);
      &lt;/script&gt;
  </code></pre>
  
  <p>Does anyone know a way to block this redirect event from the browser's back button/history? Your help is appreciated! Thanks!</p>