//登陆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>
上边的可能有较明显的打开关闭痕迹