title: What methods are blocking in Javascript?
body: <p>I'm trying to override the standard <code>confirm()</code> method in Javascript (make a nice UI and stuff). I've read a 100 posts that it "can't be done", but I don't want to give up until I have given it a fair shot. :)</p>
  
  <p>So, the real problem is of course that the <code>confirm()</code> method must block all javascript execution until the user selects an option. So, what are the methods in Javascript that have blocking behavior? I've been able to come up with 5:</p>
  
  <ul>
  <li><code>alert()</code> - does not suit me, because it displays an unwanted UI of its own;</li>
  <li><code>confirm()</code> - the same problem as <code>alert()</code>;</li>
  <li>infinite loop - even modern browsers will eat away CPU like crazy and display a "stop javascript?" prompt after a few seconds;</li>
  <li><code>XmlHttpRequest</code> in synchronous mode - sort of, but it involves server...</li>
  <li><code>showModalDialog()</code> - nice, but I need a specific design, plus there are some browser compatibility requirements...</li>
  </ul>
  
  <p>The best approach I have so far is to create an <code>&lt;iframe&gt;</code> with the prompt (which then gets its own javascript execution thread) and block with <code>XmlHttpRequest</code> until the user has selected an option in the <code>&lt;iframe&gt;</code>. Unfortunately this involves passing the result forth and back between the server, and I'd like to make this 100% client-side. Also, it ties up a server thread while the dialog is opened, and there might be some browser-specific ajax-timeouts that apply.</p>
  
  <p>Can anyone think of any other Javascript methods that block execution which might be (ab)used to achieve the desired effect?</p>