您的位置:首页 > 其它

清除浏览器客户端缓存

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息