如何指示Web浏览器不缓存页面? [英] How to instruct web browsers NOT to cache pages?

查看:146
本文介绍了如何指示Web浏览器不缓存页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've got a caching problem with the Internet Explorer 6.0 and I want to instruct the browser not to cache the page he's requesting.

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

Further information: In my page, there's a random token that prevents reloading the site and posting the same information twice or more.

如果您现在为此页面添加书签,每当他请求时,都必须指示浏览器刷新站点。

If you now bookmark this page, the browser has to be instructed to refresh the site, everytime he requests it.

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

Firefox 3.0.5 does this correctly, but IE 6.0 keeps the random token in cache.

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

I included following meta tags in the affected page:

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

任何想法?
提前致谢!

Any ideas? Thanks in advance!

推荐答案

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

This is a fairly well documented googleable problem, and probably duped several times here, but fwiw this is my standard block (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

这篇关于如何指示Web浏览器不缓存页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆