how to destroy session when window close?
<p>I want to destroy session when i close window so i am using a code </p>

<p>java script code:</p>

<pre><code>&lt;script&gt;
function killSession() {
    location = 'index.php?destroySession=true';
}
 &lt;/script&gt;
</code></pre>

<p>php code:</p>

<pre><code>&lt;?php 
     if (isset($_GET['destroySession']) &amp;&amp; $_GET['destroySession'] == "true") {
    session_destroy();
    $closeWin = "window.close()";
} else {
    $closeWin = "";
}
?&gt;
</code></pre>

<p>body:</p>

<pre><code>&lt;body onload="&lt;?php echo $closeWin; ?&gt;"  onunload="killSession();"&gt;
</code></pre>

<p>But its not giving me seficient response.I want to destroy session when window close.How its possible ?</p>
