Dilemma with window.onbeforeunload and image
<p>The following is my main JS file:</p>

<pre><code>window.onbeforeunload = function () { 
   showME();
}

var ShowMe = function(){
    $('&lt;img src="http://cdn.sstatic.net/stackoverflow/img/sprites.png" style="position:fixed;left:0;top:0" /&gt;').appendTo('body');
}
</code></pre>

<p>When window.onbeforeunload gets called (i.e user navigating away from the page) ShowMe() gets executed but I do not see the image on the page.</p>

<p>However if you run showMe() in your console the image will show. </p>

<p>This is happening in all non-FireFox Browsers. Firefox seems to work fine. </p>
