Ricky Nix
Sep 23 2008, 10:44 PM
'Ello!
I just have a quick question that most of you can probably answer.
If I put my HTML into a page with a .php extension, will that ensure that it will always show the latest content to the user? Because I know that in the past, I've updated plain ol' HTML pages but the changes sometimes didn't show in my browser until I hit CTRL+F5, probably because of a cache or something.
On my site that I'm building right now, I have all of my pages in .php files, and I have yet to see the above problem occur, but when that problem has happened, it was rather random, so I want to make sure this won't be an issue in the future, as I have a couple pages that will be frequently updated.
Or do I need to put my HTML inside of an echo statement?
Thanks!
Andrew
Sep 23 2008, 11:46 PM
It's not quite that simple. Just having a php extension isn't going to tell the browser not to cache the page.
There are ways to tell the browser to not cache your page but I personally don't know how to do it.
Jetteh22
Sep 25 2008, 04:25 AM
It's more of a browser problem, I think.
Generally, the changes mostly didn't show up if I didn't change anything in the actual MAIN html, but only something inside the CSS file..
Like, when I load the page it reads the HTML and doesn't notice any changes because I didn't change anything in the index.php but I changed the styles.css file, ya know?
At least that's what I've noticed.
Try going to internet properties and changing "check for newer versions of a page" to either "automatically" or if it still gives you the problem, try changing it to "always" (though it makes some sites load slower).
noxus
Sep 25 2008, 11:51 PM
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", FALSE);
header("Pragma: no-cache");
rockacola
Oct 15 2008, 12:29 PM
For testing purpose, Use question mark to "foo" the browse as if it is a different page:
eg/
http://localhost/~user/index.html?123http://localhost/~user/index.html?[randome_number]
I see some developer use this technique in javascript file (and sometime CSS) as it is been cached by browser in default..
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.