1. 程式人生 > >session控制管理及js關閉瀏覽器銷燬session

session控制管理及js關閉瀏覽器銷燬session

//關閉瀏覽器銷燬Seesion
    var xmlHttp;
    function createXMLHttpRequest()
   {
      //IE
      if (window.ActiveXObject)
      {
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      //Other
      else if (window.XMLHttpRequest)
      {
       xmlHttp = new XMLHttpRequest();
      }
   }
   function destorySession()
   {
                       try{
                        createXMLHttpRequest();
                        var url = "destorysession.jsp";
                        xmlHttp.open("POST", url, false);
                        xmlHttp.send(null);
                        var result = xmlHttp.responseText;
                     }
                     catch(e)
                    {
                      alert("銷燬Session異常!");
                     }
    }