jQuery/javascript synchronously load an iframe
<p>We are trying to load an openx banner when a user exits our site.  We don't want to preload the banner in a div because it will incorrectly record impressions, we only want it loading when window.onbeforeunload fires.  </p>

<p>We add the iframe in onbeforeunload but the exit prompt is presented before the iframe loads and blocks it from loading until after they have answered yes or no.  I would like to prevent onbeforeunload from returning until after the iframe has completed loading or a timeout is reached.  I can't use callbacks because everything has to take place inside this one function, unless I am missing something.</p>

<pre><code>window.onbeforeunload = function () {
   $('&lt;iframe /&gt;', {
            id: 'myId',
            src: 'http://openx.mydomain.com/ad.php',
            width: 640,
            height: 480,
            frameborder: 0
    }).appendTo('#contentWrap');

    $("#prompt").overlay({
            mask: {
                    color: "#ebecff",
                    loadSpeed: 0,
                    opacity: 0.9
            },
            closeOnClick: false,
            speed: 0,
            load: true
    });
    return "lorem ipsum 25% off";
} //);
</code></pre>
