title: How to pause JavaScript execution in Internet Explorer?
body: <p>I have the following scenario:</p>
  
  <ul>
  <li>Main page</li>
  <li>Nested page</li>
  <li>Common JS file (which is included in both pages)</li>
  </ul>
  
  <p>The nested page is subsequently loaded into an iframe of the main page. Both pages invoke a function from the common JS file on page load.</p>
  
  <p><strong>Live demo:</strong><br>
  <a href="http://www.ecmazing.com/misc/pause-execution/mainpage.html" rel="nofollow">http://www.ecmazing.com/misc/pause-execution/mainpage.html</a><br>
  <a href="http://www.ecmazing.com/misc/pause-execution/nestedpage.html" rel="nofollow">http://www.ecmazing.com/misc/pause-execution/nestedpage.html</a><br>
  <a href="http://www.ecmazing.com/misc/pause-execution/common.js" rel="nofollow">http://www.ecmazing.com/misc/pause-execution/common.js</a></p>
  
  <p>The common JS file contains one global function which paints the H1 element red. I would like to pause execution at the beginning of that function, so that the execution is paused while the H1 element is still black.</p>
  
  <h2>How to do it on the main page:</h2>
  
  <p>This is trivial. Simply load the page, open the dev tools of the browser, select the common.js file, and set a break-point at the first line of the function. Now, <strong>reload</strong> the page. The break-point will <strong>persist</strong> the reload, and execution will be paused.</p>
  
  <h2>How to do it on the nested page:</h2>
  
  <p>Now, in Chrome and Firefox (Firebug), the break-point that was set above (for the main page), will also work for the nested page. Both pages use the same JS file, and setting a break point in that file will apply for both pages automatically. Unfortunately, this rule does not apply to IE. </p>
  
  <p>And even worse, even if I set the break point subsequently, and then <strong>reload the iframe only</strong>, the break-point will <strong>not</strong> persist. </p>
  
  <p>So, I don't know how to pause execution for the nested page in IE. Can it be done? (I'm dealing with this by manually setting a <code>debugger;</code> at the beginning of the function, but I would love to be able to set the break-point via the dev tools in IE, if that's possible.)</p>