My customers frequently express frustration over not seeing the improvements I've made to my CSS or JS effects. The issue seems to be related to cached files.
Perhaps this code snippet could provide a solution:
$(document).ready(function(){
var currentStatus = 0;
var previousStatus = localStorage.getItem('clear');
if (currentStatus !== previousStatus) {
localStorage.setItem('clear', currentStatus);
window.location.reload(true);
}
});
The next time I modify the css
or js
, the value of var currentStatus
will switch to 1
.
After that, it will revert back to 0
and so forth.
I have yet to test this method, but it appears straightforward and should be effective.
Can you spot any potential drawbacks?