当前位置:开发者网络 >> 技术教程 >> JSP教程 >> 资料/其它 >> 内容
精彩推荐
分类最新教程
分类热点教程
  
如何使页面不被浏览器Cache保留
作者:未知
日期:2004-05-26
人气:
投稿:xiaxia(转贴)
来源:未知
字体:
收藏:加入浏览器收藏
以下正文:
方法一
<%
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'>
相关文章: