PDA

View Full Version : Simple META Tag Question


jimbo
06-08-2000, 10:15 PM
I want my main page to not be stored in the users' cache.[nbsp][nbsp]I know for NS I should use the Pragma meta, but what should I use for Internet Explorer?

Thanks!

:)

Charles Capps
06-09-2000, 01:36 AM
If pragma no-cache isn't working, then you have the IE bug.[nbsp][nbsp]This is a Microsoft confirmed bug in IE5 - regardless of what you say inside the document, it'll be cached.[nbsp][nbsp]There are two sure-fire solutions.

The first is to make sure the client accesses the page using a query string, such as:
http://www.domain.com/index.html?stuffgoeshere

The second would be a little .htaccess modification:
<FilesMatch *.html>
Header add Cache-control no-cache
</FilesMatch>

(The stuff you learn trying to figure out why things start caching when you haven't changed anything...[nbsp][nbsp]*sigh*)

JoeRT
06-09-2000, 10:07 AM
Another .htaccess method I've used with great success is mod_expires.[nbsp][nbsp]See http://apache.org/docs/mod/mod_expires.html for more info.

For example, in my .htaccess file it says...

ExpiresActive On
ExpiresDefault A900

This means all content will expire 900 seconds after it is accessed by a user.[nbsp][nbsp]It can be set up per directory, so my /images directory has ExpiresDefault M604800 which means the items in that directory will expire from cache 604800 seconds (1 week) after they were modified.[nbsp][nbsp]Then all my directories that update frequently I have set to however often they're modified.[nbsp][nbsp]You can also set by type, so instead of ExpiresDefault it would say

ExpiresByType image/gif A900

for example.

I fought with browser caching for a long time... so far, this has proven to be the most successful.

------------------------
Joe Torsitano
www.weatherforyou.com (http://www.weatherforyou.com)
www.tiswest.com (http://www.tiswest.com)
[nbsp][nbsp]-- Need a &quot;Men in Black&quot; memory pen thing for caches :)

Shalazar
06-09-2000, 07:19 PM
This sounds like an excellent utility.[nbsp][nbsp]WOuld you recommend its use for a large image gallery, where people return to view the same images several times over?

90%+ of my bandwidth is dedicated to my image galleries, so how could I implement this to allow caching of the images they've already viewed? Does it simply entail applying the .htaccess statements to the image directories where the actual images are contained?

Secondly, if the user manually clears their browser cache, does that take priority over this expire statement?

Thanks for your time, and for posting a great set of ideas.