How to clear browser cache for CSS files

Every time you change external files like CSS (Cascading style sheets), you have to clear cache on the browser to see the changes. Clearing cache on application load is a a frustrating step for users. Here is a solution:
Add a questions mark and  string to the end of the UTL of the CSS fil, example "?version=xx.xx.x". On application load, the browser will think that this is a new CSS file, but when it parses it it will get the file name with out the "?flush=1". 
Caching:

<link rel="stylesheet" href="css/html_tags.css?version=xx.xx.xx" type="text/css">

NOT caching

<link rel="stylesheet" href="css/html_tags.css" type="text/css">:

Ref:

No comments:

Post a Comment