Force Refresh Code that Has Force

oaktrees
oaktrees used Ask the Experts™
on
Hi,

Found these meta tags to ensure a page always reloads.

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">

Open in new window


Seen some pages where, despite having them, the cache still is used.

What can you recommend to add to these to be sure that the page arrives fresh each time?

Thanks!

OT
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
nociSoftware Engineer
Distinguished Expert 2018

Commented:
slight random changes in the URL? if you dont use the query part add a ?id=<large-randomnumber> to the URL?

Author

Commented:
This was like a dead simple url. A homepage.  No trailing queries at all.

Something like www.loremmmipppsum.com

Nothing to it than the URL itself.

Is

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">

Open in new window


all that is needed?  Or, are there other strategies?
Senior Developer
Commented:
As the tags attribute names say: http-equiv.

These values can also be sent in the HTTP header.

But the HTTP header values have precedence over the HTML meta values (see HTML Document Representation).
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
I'm confused.  How should we write them if we want them as header values?  Seems like metas are in the header already.  Am I right?
ste5anSenior Developer

Commented:
It depends on your use web server and whether you have full control over it and how you create/deliver content.

In the case of Apache, read it's Caching Guide.
When using PHP you may control per file using the header() method.

Author

Commented:
Hi,

Ok.  Thanks.

Please give me some time to review before we close this question.

Many thanks,

OT

Author

Commented:
Thanks! :)))

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial