title: Halt JavaScript execution without locking up the browser
body: <p>Are you able to halt JavaScript execution without locking up the browser? The way you would normally halt execution is to do an infinite <code>while()</code>-loop, but in the case of FireFox, it locks up the browser until the loop has ended.</p>
  
  <p>What's your take on this?
  <br />
  <br />
  <br />
  I am trying to override <code>window.confirm()</code> to implement my own dialog using HTML. I am doing this so I don't have to change existing code (it's a pretty big code-base).</p>
  
  <p>I need to be able to halt execution to allow user-input; to in turn return a boolean like the standard confirm function does:</p>
  
  <pre><code>if (confirm("..."))
  {
      // user pressed "OK"
  }
  else
  {
      // user pressed "Cancel"
  }
  </code></pre>
  
  <p><br />
  <br />
  <strong>Update</strong></p>
  
  <p>To my knowledge; this cannot be done using <code>setTimeout()</code> or <code>setInterval()</code> since these functions execute the code thats given to them asynchronously.</p>