清除浏览器客户端缓存
2015-01-04 21:54
501 查看
HTML:
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache"> // IE 5以下被忽略
<meta http-equiv="Pragma" CONTENT="no-cache">
ASP:
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.CacheControl = "no-cache"
ASP.net/C#:
modified from: http://blog.joycode.com/uestc95/posts/22507.aspx
// Date in the past
HttpContext.Current.Response.Expires = 0;
HttpContext.Current.Response.ExpiresAbsolute=DateTime.Now.AddDays(-1);
// always modified
HttpContext.Current.Response.AppendHeader("Last-Modified", DateTime.Now.ToString("r", DateTimeFormatInfo.InvariantInfo);
// HTTP/1.0
HttpContext.Current.Response.AddHeader("pragma","no-cache");
// HTTP/1.1
HttpContext.Current.Response.AddHeader("cache-control","private");
HttpContext.Current.Response.CacheControl="no-cache";
PHP:
modified from: phpManual
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
JSP:
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","No-cache");
全文摘自:http://www.newsmth.net/pc/pccon.php?id=1396&nid=142815
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache"> // IE 5以下被忽略
<meta http-equiv="Pragma" CONTENT="no-cache">
ASP:
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.CacheControl = "no-cache"
ASP.net/C#:
modified from: http://blog.joycode.com/uestc95/posts/22507.aspx
// Date in the past
HttpContext.Current.Response.Expires = 0;
HttpContext.Current.Response.ExpiresAbsolute=DateTime.Now.AddDays(-1);
// always modified
HttpContext.Current.Response.AppendHeader("Last-Modified", DateTime.Now.ToString("r", DateTimeFormatInfo.InvariantInfo);
// HTTP/1.0
HttpContext.Current.Response.AddHeader("pragma","no-cache");
// HTTP/1.1
HttpContext.Current.Response.AddHeader("cache-control","private");
HttpContext.Current.Response.CacheControl="no-cache";
PHP:
modified from: phpManual
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
JSP:
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","No-cache");
全文摘自:http://www.newsmth.net/pc/pccon.php?id=1396&nid=142815
相关文章推荐
- [转]浏览器(客户端)缓存
- 浏览器(客户端)缓存
- 多种浏览器清除缓存的方法小结
- 浏览器如何清除缓存
- 清除微信浏览器网址的缓存,cookie
- 如何清除浏览器的缓存以达到不让别人从缓存中偷取网页资料?
- js清除浏览器缓存的几种方法
- js清除浏览器缓存的几种方法
- 用ajax清除浏览器缓存的js、css、图片等
- 如何清除浏览器缓存?
- 禁止浏览器前进和后退 清除缓存
- MVC清除缓存,可以解决浏览器后退键带来的问题
- 清除浏览器缓存
- 各种浏览器清除缓存的方法。
- 如何清除浏览器缓存?
- 设置客户端浏览器缓存
- jsp中如何避免客户端浏览器在刷新时,使用缓存的数据
- 清空浏览器客户端的缓存
- 清除浏览器缓存js文件的几种方法
- jsp清除浏览器中的缓存