0

I have made a simple web-page including a couple of static pages, a css file, and a couple of images.

After I changed the css the page looks strange for those who cached the page from earlier visits.

After googling I realized that there are at least two different techniques to force visitors to load the page (found here):

  1. Do not allow the user to store the data in cache at all:

  2. Refresh the page after a certain time interval:

Are there better ways?

Thanks!

1 Answers1

2

Put a query string on your link rel tag and change it each time you update your css

some answers to this question

in short

<link rel="stylesheet" xhref="http://www.​yoursite.com/style.css?​version=1" type="text/css" /> 

change to

<link rel="stylesheet" xhref="http://www.​yoursite.com/style.css?​version=2" type="text/css" />

when you update your css.

Don't know about best but this way it's only refreshed every time your css changes.

Community
  • 1
  • 1
Beeblbrox
  • 351
  • 1
  • 11
  • Thanks Beeblbrox, but wouldn't that mean that I must update each page whenever I change the css? – AD - Stop Putin - Mar 24 '12 at 12:26
  • yeah there is that drawback, depends on the scale of the project and how you're managing your html files, if you're manually managing dozens of html using the same css this isn't useful, if you're using a CMS template or similar it's great! – Beeblbrox Mar 24 '12 at 12:29