Hi Guys
I'm looking for a script that looks at the page(s) content and is not the same as in the cache etc, refreshes the page on load.
Any suggestions...
In javascript, not that I know of. Other than this battery of meta tags (may be others, these not 100% effective in all browsers, I am told):
I'm not, as I say, aware of anything in javascript however, due to some experiences as webmaster on various servers over the years, it appears to me that there must be something server side that can affect this to a degree, with individual browsers having some say in the matter.HTML Code:<meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="Mon, 01 Jan 1990 12:00:00 GMT"> <meta http-equiv="Cache-control" content="no-cache"> <meta http-equiv="Cache-control" content="must-revalidate"> <meta http-equiv="Cache-control" content="max-age=0">
Neither of these two avenues refreshes the page per se rather, they detect if there is new content and have the browser serve from the source instead of the cache or always serve from the source - if that is allowed by the browser's settings/default behavior.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
There isn't any way.Originally Posted by jscheuer1
User agents aren't required to respect meta elements at all, and intervening caches, which can be just as important as the browser (if not more), will never check them. HTTP headers should always be sent by the server.Other than this battery of meta tags (may be others, these not 100% effective in all browsers, I am told):
I have issue with the first and third elements (or their proper HTTP equivalents). Attempting to prevent any sort of caching is rarely productive, and only forces the client to make requests that it may not need to do. Trying to prevent caching is appropriate if the resource always changes, or in an effort to protect privacy, but should be avoided at other times. Caching is your friend.HTML Code:<meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="Mon, 01 Jan 1990 12:00:00 GMT"> <meta http-equiv="Cache-control" content="no-cache"> <meta http-equiv="Cache-control" content="must-revalidate"> <meta http-equiv="Cache-control" content="max-age=0">
What is important in this situation is revalidation. This will automatically occur whenever the cache finds the resource to be stale. Properly chosen Expires header and max-age Cache-Control directive values will accomplish this just fine.
As always, the user has the final say. If they configure their browser to only revalidate periodically, rather than whenever indicated by the server, there's little that can be done.[...] with individual browsers having some say in the matter.
One approach is to make the URL unique, usually by adding a timestamp to the query string. As the majority of the URL (all of it except the fragment, if present) identifies a resource, even changing the query string will make the browser consider it to be different, forcing an end-to-end request.
Mike
Originally Posted by Mike
A circular post in that the query string could be appended via javascript. I know this would be a javascript enabled only solution but, perhaps that is all simonf requires.Originally Posted by Mike
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
I never said that scripting couldn't be used as part of a solution to the general problem of retrieving fresh versions of a resource, just that it couldn't be used to do what Simon asked: to compare cached and origin content, and force an update if the former is out-of-date.Originally Posted by jscheuer1
Perhaps, but sending accurate HTTP headers is still a good idea.I know this would be a javascript enabled only solution but, perhaps that is all simonf requires.
Mike
Bookmarks