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