Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
575 views
in Technique[技术] by (71.8m points)

caching - What is the proper way to tell the browser not to cache?

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"> 

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

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.

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

This is happening on an IIS 5.0 on Windows 2000.


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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

http://httpd.apache.org/docs/2.0/mod/mod_expires.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...