Problem with Javascript onUnload method
<p>I have a requirement that when the user clicks on [X] button of the browser, I should give them a message.</p>

<p>I accomplished this task using the onUnload method of JavaScript.</p>

<p>Now, if even I refresh the page, then also the same message appears!</p>

<p>Why this is so and how to overcome?</p>

<p>The code is here</p>

<p>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;
&lt;HTML&gt;
 &lt;HEAD&gt;
  &lt;script language = "javascript"&gt;</p>

<p>function Message()</p>

<p>{
     alert("Are you sre you want to leave?");
  }</p>

<p>&lt;/script&gt;
 &lt;/HEAD&gt;</p>

<p>&lt;BODY  onUnload="Message();"&gt;
&lt;/BODY&gt;&lt;/HTML&gt; </p>

<p>Please help</p>
