menardmam
menardmam

Reputation: 9986

DO not load a HTML page from cache

Here's what I need to get, the version of the page must be the last. It's a price list, no way i want the price from last week.

So I got some code from everywhere on the web and paste it to my header, here it is:

<meta http-equiv="Pragma" content="no-cache"> 
<meta http-equiv="expires" content="0"> 

I dont know if it's enough or what it does, but it must tell the browser:

  1. Download the page
  2. Forget the cache, it's too old even if you hit reload 10 times in a row. Download it again.

So the question: is it the proper way? It's a HTML only page, no jQuery nor PHP.

Upvotes: 4

Views: 8107

Answers (1)

DougM
DougM

Reputation: 2888

Those meta tags have an http-equiv attribute because they're a document-level placeholder for items that should be in the HTTP response. Instead of sending requests for your bare resource, clients should be sending a "GET if not modified since X" request, and they should be set correctly in your header. Ask your host for reference on how to provide those "no cache" options.

See this exact duplicate of your question for more information, btw.

Also, a knowledge-utility basis, add a "Prices good until XXXX" in the content of your page. It's a price list, so someone will print it out and think that it's still a good price if you don't have an indicator otherwise.

Upvotes: 1

Related Questions