Open popup onbeforeunload
<p>I want to open pop-up on exit (Not "stay on page or leave" box). I can't get this working. Where do I make mistake ?</p>

<pre><code> function poponload()
{
testwindow = window.open("http://www.google.com", "mywindow",     
"location=1,status=1,scrollbars=1,width=5,height=5,left=100,top=100");
}

$(document).ready(function () {

window.onbeforeunload = function () { 

poponload();

});


$(window).unload(function () {

poponload();

});


});    
</code></pre>
