Monday, April 18, 2016

How to Solve caching problem of css & js files :

How to solve caching problem of css & js files :

1- Using Ghost QueryString : 
When Adding your js and css files, add a querystring to the end like "version number (?ver=1.0)".
and Just increment the number everytime you add something new and all you problems with caching will go away.
This will force the browser to download the file.

<script type="text/javascript" src="/javascripts/main.js?ver=1.0"></script>
<script type="text/javascript" src="test.js?q=123"></script>

2- Using browser private mode :
   - like chrome incognito mode.
   - MS IE OR Edge inprivate mode.

No comments: