简体   繁体   中英

How to disable cache for some files in google chrome DevTools

Whenever I run the project, many files(CSS, image and js) requested from a remote server and the project load slowly.

For handling this issue, I unchecked disable cache for all files in the network tab of Chrome DevTools(for caching all files) as follows:

禁用Chrome中某些文件的缓存

But the problem started when I need some files(for example test.js,...) don't cache because they change quickly.

How to disable cache for some files(JS, CSS,...) in google chrome DevTools?

There are many ways to disable cache for specific files.

Maybe the two most common are:

  1. The build-in bundle system of .net
  2. Add query to your script file name ie:

     <script src="../whatever/someFile.js?version=1234" /> //Where version can be a variable taken from web.config or DateTime.Now() of some sort. 

press ctrl+shift+i (devTools>network) select [Disable cache]

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM