I want to destroy session when i close window so i am using a code
java script code:
<script>
function killSession() {
location = 'index.php?destroySession=true';
}
</script>
php code:
<?php
if (isset($_GET['destroySession']) && $_GET['destroySession'] == "true") {
session_destroy();
$closeWin = "window.close()";
} else {
$closeWin = "";
}
?>
body:
<body onload="<?php echo $closeWin; ?>" onunload="killSession();">
But its not giving me seficient response.I want to destroy session when window close.How its possible ?