什么是正确的方式来告诉浏览器不缓存? [英] What is the proper way to tell the browser not to cache?

查看:264
本文介绍了什么是正确的方式来告诉浏览器不缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,总是需要保持电流。我不希望浏览器缓存它。为此,这个元标记中嵌入了页:

I have a web page that always needs to stay current. I do not want the browser to cache it. To that end, this meta tag is embedded with the page:

<meta name="Expires" content="Tue, 01 Jun 1999 19:58:02 GMT">

然而,某些浏览器似乎忽略它。 Chrome是它特别糟糕,但其他浏览器往往会做同样的事情。

However, some browsers seem to ignore it. Chrome is particularly bad at it, though other browsers tend to do the same thing.

当我选择的页面从书签栏,大部分时间,它甚至不打服务器,只需加载它从缓存中。如果我再preSS F5,它转到服务器并获取一个新的副本。

When I pick the page from the bookmarks bar, most of the time, it doesn't even hit the server, just loads it from cache. If I then press F5, it does go to the server and fetch a new copy.

我失去了一些东西简单?我以为过期meta标签是它的完成方式。

Am I missing something simple? I thought the expires meta tag is the way it's done.

这是上的IIS 5.0在Windows 2000上发生的事情。

This is happening on an IIS 5.0 on Windows 2000.


底线:看起来像HTML code pretty里面很多的meta标签什么都不做。然而,设定到期标记内的HTTP的伎俩很好。

Bottom line: looks like meta tags inside the HTML code pretty much do nothing. However, setting the expires tags within the HTTP does the trick nicely.

推荐答案

发送您使用您的服务器Expires头。特别是,如果你使用Apache,看看这个:

Send your expires headers using your server. Specifically, if you're using apache, look at this:

<一个href=\"http://httpd.apache.org/docs/2.0/mod/mod%5Fexpires.html\">http://httpd.apache.org/docs/2.0/mod/mod%5Fexpires.html

这篇关于什么是正确的方式来告诉浏览器不缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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