JS关闭浏览器Session失效.

 1、onunload调用下面js函数

function   removeline(){     
  if(event.clientX<0&&event.clientY<0){     
     document.write('<iframe   width="100"   height="100"   src="page/removeline.jsp" mce_src="page/removeline.jsp"></iframe>  
<OBJECT   classid=CLSID:8856F961-340A-11D0-A96B-04FD705A2            height=0     id=WebBrowser   width=0></OBJECT>');     
     document.all.WebBrowser.ExecWB(45,1);     
  }     
 } 

 

removeline.jsp   加上invalidate()代码就可以了


2、onbeforeunload事件触发小的窗口,在这个弹出页面里面做注销操作 

<SCRIPT language=javascript>  
    window.onbeforeunload=function(){  
        var n = window.event.screenX - window.screenLeft;         
            var b = n > document.documentElement.scrollWidth-20;         
            if(b && window.event.clientY < 0 || window.event.altKey) {    
                    self.location="/cas/logout";  
            self.location="/epsa/logout";  
            self.location="/idc/logout.jsp";  
            self.location="/report/logout.jsp";        
            alert('您已经退出。');  
        }  
        else{  
              
        }     
    }  
</SCRIPT> 


原文:http://blog.csdn.net/Zianed/archive/2009/06/09/4255541.aspx

参考文献:http://www.cnblogs.com/noidea/archive/2008/12/17/1357059.html

你可能感兴趣的:(JavaScript,session,function,iframe,浏览器,WebBrowser)