popup when the browser closes
I am using onbeforeunload event
<script>
function showPopup()
{
urlstring = "http://www.mydomain.com/popup.php";
window.open(urlstring,'mywin',"height=400px,width=500px,status=no,toolbar=no");
}
</script>
<body onbeforeunload="showPopup(); ">
but it also show popup when ever I hit back space and page refresh.
I want show popup only when browser close and not show when hit back space.
but it shows all conditions.
Please suggest me any other solution for this.