Force browser to refresh css, javascript, etc

前端 未结 16 1859
花落未央
花落未央 2020-11-29 19:16

I\'m developing a website based on Wordpress source code through XAMPP. Sometimes I change the CSS code, scrips or something else and I notice my browser takes time to apply

16条回答
  •  悲哀的现实
    2020-11-29 19:59

    Developer point of view
    If you are in development mode (like in the original question), the best approach is to disable caching in the browser via HTML meta tags. To make this approach universal you must insert at least three meta tags as shown below.

    
    
    
    

    In this way, you as a developer, only need to refresh the page to see the changes. But do not forget to comment that code when in production, after all caching is a good thing for your clients.

    Production Mode
    Because in production you will allow caching and your clients do not need to know how to force a full reload or any other trick, you must warranty the browser will load the new file. And yes, in this case, the best approach I know is to change the name of the file.

提交回复
热议问题