title: onbeforeunload works also with refreshing
body: <p>I did this question few days ago (<a href="https://stackoverflow.com/questions/15326562/java-session-deleted-after-page-refresh">Java session deleted after page refresh</a>) and I didn't have an answer. Maybe because the problem was in the onbeforeunload event. 
  with:</p>
  
  <pre><code> &lt;body onbeforeunload="chiudi()"&gt;
  </code></pre>
  
  <p>I would like to rifle the session. The problem is that in this way the session will be<br>
  rifled also if the user refresh the page. How can I fix it?</p>
  
  <p>Here's my javascript function chiudi()</p>
  
  <pre><code> function chiudi(){
   var xmlHttp = new XMLHttpRequest();
      xmlHttp.open("POST", "SvuotaSession", false);
      xmlHttp.setRequestHeader("Content-type",
              "application/x-www-form-urlencoded");
      xmlHttp.send(null);
   }
  </code></pre>