Search code examples
htmlbrowserrefresh

HTML link that forces refresh?


Is there a way to construct a link to a URL that forces the browser to ignore any cache it might have for that URL?

We have some websites that have recently changed after literally years of static content. Users click shortcuts, favorites, or type URL's to these sites and get old, cached content. I would like to have a page with a link that goes to the same URL but forces the browser to get the fresh content.

is that possible? Cross-browser?


Solution

    1. Change all the links to the page with a nonsense query parameter: products.html?happy=days
    2. Change all the resources on the page to use another nonsense query parameter: style.css?the=fonz

    You can do it in a systematic way using dates or timestamps or version numbers, or haphazardly using sitcoms, muppets, mountain ranges, and small mammals.