css and js cache clear

by Prakash 2013-11-06 18:20:45

Web developers make frequent changes to the css and javascript files. But those files will be served fro the browser cache for the clients. So the updates you make doesn't reflect for the end users until the cache is expired by the browser. Same situtaion exists if there is Nginx cache is configured also.

Whenever you make changes to the css or js files just change the version of the file in the file link.

For example if you make changes to the style.css file which looks like below :


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


Apply a version like below :


<link href="style.css?v=2" rel="stylesheet" type="text/css" />


When you further make changes alter the version like style.css?v=3. This way webmasters can escape from browser cache issues when the make changes to the files.

Tagged in:

1202
like
0
dislike
0
mail
flag

You must LOGIN to add comments