Friday, 7 December 2012

Clear Session On Browser Close Using Javascript

Clear Session On Browser Close Using Javascript




    <script type="text/javascript">
    function window.onbeforeunload()
    {
        var xmlHttp;
        try
        {
            // Firefox, Opera 8.0+, Safari
            xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {
            // Internet Explorer
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
        {
            xmlhttp.open("GET","exit.aspx",false);
            xmlhttp.send();
        }
     }
    </script>


Reference:

 http://forums.asp.net/p/1237752/2255401.aspx

No comments:

Post a comment

Thank You for Your Comments. We will get back to you soon.

back to top