登陆页面登陆之后页面回退到上级非登陆页面

//登陆A->B->C   B为登陆页,A为网站首页,C回退到A

//<meta http-equiv="Pragma" content="no-cache">
//<meta http-equiv="Cache-Control" content="no-cache">
//<meta http-equiv="Expires" content="0">

<script type="text/javascript">
$(function(){
	var entryId = '<%=session.getAttribute("entryId")%>';//此处js获取session值,因为用的是单引号引的,虽然session取值为null但是entryId却实'null'字符串
	if(entryId != 'null' && entryId != ''){
		window.history.go(-1);
	}
});
</script>
</head>
<body>
	<!--begin 此处做了三次判断上边js也做了一次判断防止兼容性等问题,防御式编程 -->
	<%  response.setHeader("Cache-Control", "no-cache");  
	response.setHeader("Cache-Control", "no-store");  
	response.setDateHeader("Expires", 0);  
	response.setHeader("Pragma", "no-cache");  %>
	 <c:if test="${!empty sessionScope.entryId }">
		response.sendRedirect(request.getRequestUrl());
	 </c:if>
	 <c:if test="${!empty sessionScope.entryId }">
	 	 	response.write("<script type='text/javascript'>window.history.go(-1);</script>");
	 </c:if>
	 <c:if test="${!empty sessionScope.entryId }">
	 	 	response.write("< script type='text/javascript'>location.replace(window.parent.location.href)< /script>");
	 </c:if>
	 <!--end-->

参考:

http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=3628550

<A   HREF= "PageName.htm "   οnclick= "javascript:location.replace(this.href);   

event.returnValue=false;   ">  


<html>   
<head>   
<meta   http-equiv= "Expires "   CONTENT= "0 ">   
<meta   http-equiv= "Cache-Control "   CONTENT= "no-cache ">   
<meta   http-equiv= "Pragma "   CONTENT= "no-cache ">   
</head> 


<script   language= "JavaScript ">   
<!--   
javascript:window.history.forward(1);   
//-->   
</script>  


<body   οnlοad= "if(history.length> 0){window.opener=null;window.close();window.open(window.location.href, '_blank ');} "> 



http://www.jb51.net/article/48508.htm

<script language="JavaScript"> 

function logout(){ 

window.close(true); 

window.open("logout.do"); 

} 
</script> 
<button onClick="logout()">Logout</button>

上边的可能有较明显的打开关闭痕迹


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值