The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

No-Cache Tag

I have a website that is constantly being updated and alot users email me and complain they don't see the changes and I tell them to refresh and of course they see the changes. I am thinking about using "<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> " and was wondering if people could give some advice on it.

Is it compatible with IE, FF, etc...?

What are the drawbacks if I put this in every single page in my website?

no-cache gets ignored by FF so when you have for instance a form and you need the browser to NOT cache it you'll have no-cache no-store which FF will follow. IE obeys no-cache pretty well-- it'll break the Back button on POST forms if you're not careful.

Using the tag I'm pretty sure is for forms with POST methods only. Everything else preferably via the server headers as Tommy said.

As a user I never have the problem of cached pages as I always type in the URL or choose via a Bookmark. I don't use Opera's weirdo page (speed dial? I have little blank squares I ignore), I don't let Firefox save its tabs when open, and I never click on Chrome's "most visited pages" thingie. Users who leave their tabs and stuff open should not complain about not seeing new content. Don't they know it's not the real page they're seeing but what the browser remembers?
Reminds me of my mom who would drive around and not know what the "little flag in the water light" meant. Maybe some user education is necessary? It would at least help them with other sites they're not seeing fresh.

I read somewhere that it does lower your rank in search engines, is this true?

Trinity, think of all those authorised banking pages where you log in to view your account. Because they're secure, they are never cached, by anyone. Does that hurt banking sites? Nope. Their cacheble pages show up just fine. So, you're cool.

That link from Tommy was pretty cool. I bookmarked it. Unless I'm confusing it with a mirror, I've never heard of a proxy cache before. I wonder if there's any way to know that when I'm accessing a site whether I'm actually sending a GET request to that server or to some proxy somewhere in teh Tubes...?

Thanks for the advice. I think I will go ahead and use it. My primary daily users will be using IE6 (ick) so I'm not too worried about the occassional FF users that might have to hit refresh if needed.

Should I use the format below with the additional head tags at the bottom for IE issues or is it not needed.

Code:

<meta http-equiv=“Expires” content=“0”>
<meta http-equiv=“Pragma” content=“no-cache”>
<meta http-equiv=“Cache-Control” content=“no-cache”>
To get it to delete at a special time, such as midnight, use
<META HTTP-EQUIV=“Expires” CONTENT=“Fri, 19 Oct 200400:00:00 GMT”>
To affect Internet Explorer 4, you have to add a second <head></head> block at the end of your html code, after the </body> tag but before the </html> tag and insert a duplicate of the Pragma=no-cache tag:
<HTML>
<HEAD>
<META HTTP-EQUIV=REFRESH CONTENT=5>
<TITLE> Pragma No-cache </TITLE>
</HEAD>
<BODY>
??
</BODY>
<HEAD>
<META HTTP-EQUIV=PRAGMA CONTENT=NO-CACHE>
</HEAD>
</HTML>

I didn't check it to see if it was 100% true, but as far as I know you get one <head> per document. The second one should be illegal.

Second, Tommy's link will tell you that while you can stick all those meta tags on your page, the HTTP headers on the server (if you have any) will override them, and frankly, you can't count on all user agents (browsers) obeying the meta tags but they WILL obey most if not all of the HTTP headers (assuming you're using HTTP1.1 cause it seems everyone does nowadays).

Third, your quotes shure look fuhnny. "" are the correct quotes, not the funny strange angled ones (each different type of quote really is a completely different character as far as computers are concerned). So assuming you have zero control over your server or you just want to keep the meta tags in your page anyway, change the funny quotes to regular straight ones.

Thanks for the advice. I took the HTML above from the microsoft site on their fix for IE so yes, I will definitely be fixing the funny quotes. I read the advice about adding the double head tags from the site below. http://www.htmlgoodies.com/beyond/re...le.php/3472881

One more questions, please...

Does editing the http headers on the server also fix the problem of pdfs that get updated but sometimes users having to hit refresh to see the updated pdf?

Does editing the http headers on the server also fix the problem of pdfs that get updated but sometimes users having to hit refresh to see the updated pdf?

It should, if you set a reasonable expiry date for them. The trick is to find the right balance: if they expire too soon you waste bandwidth and your users experience poor site performance; if they expire too late users may miss updates.

Normally, setting Cache-Control: must-revalidate should solve the latter problem. It means user agents should always check for freshness before using a cached version (using an If-Modified-Since header). If the server responds with a 304 the user agent will know its cached copy is still fresh.