How to force the browser to reload cached CSS/JS files?

后端 未结 30 5014
青春惊慌失措
青春惊慌失措 2020-11-21 05:49

I have noticed that some browsers (in particular, Firefox and Opera) are very zealous in using cached copies of .css and .js files, even be

30条回答
  •  庸人自扰
    2020-11-21 06:01

    Simply add this code, where you want to do hard reload (force browser to reload cached CSS/JS files ) Do this inside the .load so it does not refreshes like a loop

     $( window ).load(function() {
       location.reload(true);
    });
    

提交回复
热议问题