How To Clear The Session?

By Goniey N (Mr. G)

How To Clear Session When The User Closes a Window Or Browser?

<script type="text/javascript">
function window.onbeforeunload()
{
     var XMLHttpRe;
     try
     {
          //For "Firefox", "Opera 8 Or Higher" & "Safari" Browsers
          XMLHttpRe=new XMLHttpRequest();
     }
     catch (e)
     {
          // Internet Explorer Browser
          try
         {
               XMLHttpRe=new ActiveXObject("Msxml2.XMLHTTP");
         }
         catch (e)
         {
               try
               {
                     XMLHttpRe=new ActiveXObject("Microsoft.XMLHTTP");
               }
               catch (e)
               {
                     alert("Your Browser Does Not Support!");
                     return false;
               }
          }
          if(event.clientX > document.body.clientWidth && event.clientY < 0 || event.altKey)
          {
               XMLHttpRe.open("GET","exit.aspx",false);
               XMLHttpRe.send();
          }
     }
}
</script>

How To Clear The Session?  (1227 Views)