Copy link to clipboard
Copied
When I update a web page for a client, I get tired of telling them to load the page which is usually the previous web page version and then tell them to hit the browser refresh button. Two questions:
1. Can I add code to have the latest page always loaded?
2. If you don't hit the refresh button, how long does it take for a browser to finally load this new page, a day, 2 days, etc.
Thanks.
Don
Add the following in your head content -
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
Don't forget to remove before the page goes live.
Copy link to clipboard
Copied
Add the following in your head content -
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
Don't forget to remove before the page goes live.
Copy link to clipboard
Copied
If you find a reliable cross browser way to make this work, let me know.
The no-cache & pragma meta is not 100% reliable.
Sometimes I use expired and last-modified date & time in my header. In theory, the browser is supposed to compare the cached version with the server version and display the latest one. But that's not 100% either.
Nancy
Copy link to clipboard
Copied
pziecina's answer above is the correct official answer.
If you are looking for something to supplement that for a browser with a sticky cache... I often have luck appending a query string to the address. The below javascript would crawl all the images on the page and force them to get refreshed versions by appending the Linux timestamp onto the query string.
<script type="text/javascript">
$(document).ready(function(){
$('img').each(function(){
var date = new Date;
// add the current unix timestamp in microseconds to the the image src as a query string
this.src = this.src + '?' + date.getTime();
});
});
</script>
Copy link to clipboard
Copied
I've used similar scripts to avoid caching in the past.
In my experience, they've worked more reliably than the <meta> options available.
Copy link to clipboard
Copied
https://forums.adobe.com/people/Jon+Fritz+II wrote
I've used similar scripts to avoid caching in the past.
In my experience, they've worked more reliably than the <meta> options available.
My husband insists on using a NoScripts addon in his browsers (an endless source of irritation, beleive me). So, JS solutions don't always work either.
This article discusses various methods and their pros & cons.
Preventing Browser Caching | Tiger Technologies Support
And their disclaimer at the bottom says,
"The tips above will work in almost all cases, but the nature of the Internet means you can't guarantee it will always work the way you hope."
Nancy
Copy link to clipboard
Copied
You could send this link to your clients.
Secrets of the Browser Developer Tools - Disable the Browser Cache
Nancy