popUpWindow is called even if the page is Refresh
<p><strong>The following script is called on close of  browser button which opens an exit popup which works great.
The problem is this function popUpWindow is called even if the page is Refresh.. how do i check that so that the pop up window doesnt open on page refresh but only when browser is closed</strong> </p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no, location=no, directories=no, status=no, menubar=no,scrollbars=no, resizable=no, copyhistory=yes, width='+width+',height='+height+', left='+left+',top='+top+', screenX='+left+', screenY='+top+'');
}
&lt;/script&gt;


&lt;body  onUnload="javascript:popUpWindow('http://www.abc.com/images/ExitPopup.jpg','300', '200', '650', '500')"  &gt;
</code></pre>
