• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

how to force browser to load fresh copy every time

Explorer ,
Mar 06, 2017 Mar 06, 2017

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

Views

54.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 06, 2017 Mar 06, 2017

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.

Votes

Translate

Translate
LEGEND ,
Mar 06, 2017 Mar 06, 2017

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2017 Mar 06, 2017

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

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 06, 2017 Mar 06, 2017

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2017 Mar 06, 2017

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2017 Mar 06, 2017

Copy link to clipboard

Copied

LATEST

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

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2017 Mar 06, 2017

Copy link to clipboard

Copied

You could send this link to your clients.

Secrets of the Browser Developer Tools - Disable the Browser Cache

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines