5

We redid the logo for our website, and I want to ensure that users see the new image when they come to our page. The logo is a background-image for a div. How do I ensure that the css is refreshed when the users come to the page?

dmr
  • 21,811
  • 37
  • 100
  • 138

3 Answers3

3

Modify the URL of the CSS to i.e. style.css?newVersion=1.

DanielB
  • 19,910
  • 2
  • 44
  • 50
  • I remember doing it once and it didn't work, I still needed to refresh with F5 to see changes... Are you sure it works on all browsers? – Episodex Jun 01 '11 at 14:04
  • 1
    If your HTML document is cached too, then the new link to the CSS will not be loaded, because it's never seen by the browser. – DanielB Jun 01 '11 at 14:30
3

Add an unused querystring parameter (eg, ?version=2011-06-01) to create a new, uncached URL.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
1

One sure (ime) way is to embed the logo background image right in the css:

.div-with-logo-image-inside {
  background-image:url("data:image/gif;base64,R0lGODlhhwASAPcAAAAAABD ... ");
}
Pete Wilson
  • 8,610
  • 6
  • 39
  • 51