AD - Stop Putin -
AD - Stop Putin -

Reputation: 305

What is the best way to force the client to reload webpage?

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!

Upvotes: 0

Views: 2388

Answers (1)

Beeblbrox
Beeblbrox

Reputation: 351

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.

Upvotes: 2

Related Questions