I've been searching on how to not get a cached version of my page. I've tried adding meta tags and even used an apparent 'cheat' by adding a second head after the body, this doesnt' work either. I do not want a timed refresh, rather, everytime someone goes onto the page it is the most recent version. Also added a function and called it onload but that just keeps going in an infinite loop. Can someone please help me? Much aprpeciated!
How to refresh page ONCE onload?
Collapse
This topic is closed.
X
X
-
Originally posted by ZafaranaI've been searching on how to not get a cached version of my page. I've tried adding meta tags and even used an apparent 'cheat' by adding a second head after the body, this doesnt' work either. I do not want a timed refresh, rather, everytime someone goes onto the page it is the most recent version. Also added a function and called it onload but that just keeps going in an infinite loop. Can someone please help me? Much aprpeciated!
Code:<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
Comment
-
I see how this works using
Code:<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
Comment
-
If you have access to your server settings, you can set the header to "expires" and the date. Or you can use the <meta>:
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 2008 08:21:57 GMT">
I'm not sure the meta version works anymore.Comment
-
Originally posted by drhowarddrfineIf you have access to your server settings, you can set the header to "expires" and the date. Or you can use the <meta>:
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 2008 08:21:57 GMT">
I'm not sure the meta version works anymore.
If you are willing to do some PHP then here is some code that will help you
[PHP]
<?php
header("Expires : Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
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' );
?>
[/PHP]
Put this code on the very top of your html page. Rename that page to .php extension.
!!!! Make sure that there are absolutely no spaces before the above snippet. If there are you will get an error.Comment
-
PHP is off topic in the html/css forum. To offer a PHP solution to someone who may not even use PHP is not helpful either.Comment
-
Hi,
I just wanted to say THANKYOU for the PHP solution its exactly what i was looking for, as for the moderator who posted stating that he was not looking for a PHP solution and should not post here, well, it was never stipulated in his original post that he required only HTML and further more people looking for solutions are looking for just that, surely the same question shouldn;t be posted in each different topic depending on the language yuor using for the same problem!
Google returned my result and directed me here, any how, thanks again for the PHP!!! :-)Comment
Comment