Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have added following meta tag in jsp page

<html>
<head>
<title>xyz</title>
<link type='text/css' rel="stylesheet" href="sdsds/sdsd"/>
<meta content="max-age=0" http-equiv="cache-control">
<meta content="no-store" http-equiv="cache-control">
<meta content="-1" http-equiv="expires">
<meta content="Tue, 01 Jan 1980 1:00:00 GMT" http-equiv="expires">
<meta content="no-cache" http-equiv="pragma">
</head>
<body><h1>jsdsdsds</h1>
<a href="abc">click me</a>
</body>
</html>

After navigating by clicking link "click me" I am opening a new page. When I click back button it is working..I want the page to expire.. Note:In both jsp page I have added same meta tag. I tried adding this

<%@ page import="java.lang.*" %>
<%
// Set to expire far in the past.
response.setHeader("Expires", "Sat, 6 May 1971 12:00:00 GMT");
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>

both above HTML and inside Head..still I can see back page., Tested in mozilla firefox 10.0 and IE8 Any suggestion?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
694 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try this

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml" >
  <title>Untitled Page</title>
  <script type = "text/javascript" >
  function changeHashOnLoad() {
 window.location.href += "#";
 setTimeout("changeHashAgain()", "50"); 
 }

function changeHashAgain() {
window.location.href += "1";
}

var storedHash = window.location.hash;
 window.setInterval(function () {
 if (window.location.hash != storedHash) {
     window.location.hash = storedHash;
}
}, 50);


</script>
 </head>
 <body onload="changeHashOnLoad(); ">
  Try to hit back!
 </body>
 </html>`

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...