Force a favicon to refresh

Ever had to change a favicon and you wanted to update it? The browser caches these icons for a long time and for good reason, because in general they don’t change that much.

There’s an easy way to let the browser get a new one (and this goes for javascripts, images, stylesheets and all other cachable content): just add a parameter to the source.

<link rel=”shortcut icon” href=”favicon.ico”/>

becomes

<link rel=”shortcut icon” href=”favicon.ico?new”/>

It only works once per change, though. So if you change it again, replace ?new with something different, like ?new2.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.