如何使页面不被浏览器Cache保留
发表于:2007-07-01来源:作者:点击数:
标签:
方法一 % response.setHeader(Cache-Control,no-cache); //HTTP 1.1 //or response.setHeader(Cache-Control,no-store);//HTTP 1.1 response.setHeader(Pragma,no-cache); //HTTP 1.0 response.setDateHeader (Expires, 0); //prevents caching at the proxy
方法一
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
//or response.setHeader("Cache-Control","no-store");//HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
方法二
import
java.text.SimpleDateFormat;
import java.util.Date;
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy - HH:mm:ss z");
response.setHeader("Expires", dateFormat.format(new Date()));
方法三
<meta http-equiv=@#Expires@# content=@#-10@#>
<meta http-equiv=@#Pragma@# content=@#No-cache@#>
<meta http-equiv=@#Cache-Control@#, @#private@#>
原文转自:http://www.ltesting.net