如何指示Web浏览器不要缓存页面?

时间:2009-02-04 12:29:59

标签: http caching http-headers

我的Internet Explorer 6.0存在缓存问题,我想指示浏览器缓存他请求的页面。

更多信息:在我的页面中,有一个随机令牌可以阻止重新加载网站并将相同的信息发布两次或更多次。

如果您现在为此页面添加书签,则必须指示浏览器在每次请求时刷新该网站。

Firefox 3.0.5正确执行此操作,但IE 6.0会将随机令牌保留在缓存中。

我在受影响的页面中包含以下元标记:

<meta http-equiv="cache-control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">

有什么想法吗? 提前谢谢!

2 个答案:

答案 0 :(得分:4)

这是一个相当详细记录的googleable问题,可能在这里多次欺骗,但是这是我的标准块(C#):

Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1
Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "no-store"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "must-revalidate"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "max-stale=0"); // HTTP 1.1 
Response.AppendHeader("Cache-Control", "post-check=0"); // HTTP 1.1 
Response.AppendHeader("Cache-Control", "pre-check=0"); // HTTP 1.1 
Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0 
Response.AppendHeader("Expires", "Wed, 09 Jun 1993 00:00:00 GMT"); // HTTP 1.0

答案 1 :(得分:0)

检查您的服务器发送的HTTP标头,这些可以覆盖HTML中meta部分的内容。