Graeme Posted April 2, 2014 Report Posted April 2, 2014 Hello All, I have been adding the new fixtures to a cricket web site for the forthcoming matches this season and someone e-mailed me to say that they could only see last year's fixtures although I knew I had uploaded them. I'm guessing it might be a caching problem. I once read about a meta tag that can be used to view fresh content on every page load but one of our friends on here suggested not to use it if you have graphics on a page. The pages in question do not have graphics so is there one I could use? Thank you as always, Best wishes Graeme Quote
falkencreative Posted April 2, 2014 Report Posted April 2, 2014 You can try this? All the advice I'm seeing about this seems a bit old. http://www.chami.com/tips/internet/113096I.html Has the visitor refreshed the page? Usually that will take care of caching issues. Quote
administrator Posted April 2, 2014 Report Posted April 2, 2014 Hi, We live in the age of web video, HD Youtube video and Netflix ... I am not so certain that forcing image downloads is really much of an issue. I would use php to force no cache as well: <?php header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 header("Expires: Sat, 27 Jul 2001 06:00:00 GMT"); // Date in the past ?> Or: header("Location: yoursite/index.php?r=".mt_rand(0, 9999999)); Stef Quote
Graeme Posted April 3, 2014 Author Report Posted April 3, 2014 Thank you, Stef, where do I put either of the code on the page, is it above everything as I have done with a PHP contact page? Best wishes Graeme Quote
administrator Posted April 3, 2014 Report Posted April 3, 2014 Hi, Yep ... header information has to be at the very top of the page, otherwise you will get an error. Why? You can't send header information after you've sent body information: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. Check it out: http://www.php.net/manual/en/function.header.php Stef Quote
Graeme Posted April 4, 2014 Author Report Posted April 4, 2014 Stef, Do I use both of the examples you give above on one page or just choose one? Also would this be a better way than using META TAGS? Thank you as always, Best wishes, Graeme Quote
administrator Posted April 4, 2014 Report Posted April 4, 2014 Hmm .... cache control is always a dice-roll from my experience, to a certain extent. I think doing it via PHP (server side) would be better because it forces the fresh load of the page. That said, I would be using this PHP: header("Location: yoursite/index.php?r=".mt_rand(0, 9999999)); .... This basically tricks the browser into thinking this is a new page, so it does not load from cache. But then again, try all of it and see what happens. Stef Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.