Nada
Nada

Reputation: 111

Force browser cache to clear

After deploying a new release of an ASP.NET website, is there a way to force clients' browsers to refresh cached items, especially for images, CSS, and Javascript files?

The problem is that I can’t go around telling everybody that uses the site to hit CTRL+F5. How can I force the browsers to do it?

Upvotes: 6

Views: 4066

Answers (1)

Elim Garak
Elim Garak

Reputation: 1827

Nada,

I have faced this issue on sites in the past, mainly FireFox and Chrome.

For each CSS and Javascript file I append a parameter ?1d= to the URL. When I deploy a change to the site that includes CSS or JavaScript it will pickup the new ID# and the end user will get the current CSS and JavaScript without the need of the hard CTRL+F5 Reset.

src="/Scripts/myJavaScript.js?id=71.11"

href="/Styles/MyStyles.css?id=71.11"

Upvotes: 4

Related Questions