简体   繁体   English

如何禁用谷歌浏览器DevTools中某些文件的缓存

[英]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. 每当我运行项目时,从远程服务器请求的许多文件(CSS,图像和js)都将缓慢加载。

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 DevTools的“网络”标签中取消选中了禁用所有文件的缓存(用于缓存所有文件),如下所示:

禁用Chrome中某些文件的缓存

But the problem started when I need some files(for example test.js,...) don't cache because they change quickly. 但是问题开始于当我需要某些文件(例如test.js,...)不缓存时,因为它们变化很快。

How to disable cache for some files(JS, CSS,...) in google chrome DevTools? 如何在谷歌浏览器DevTools中禁用某些文件(JS,CSS等)的缓存?

There are many ways to disable cache for specific files. 有很多方法可以禁用特定文件的缓存。

Maybe the two most common are: 也许最常见的两个是:

  1. The build-in bundle system of .net .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] 按ctrl + shift + i(devTools> network)选择[禁用缓存]

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Google Chrome Devtools中的debugger:/// VM *文件中访问和搜索代码 - How to access and search code in debugger:///VM* files in Google Chrome Devtools FORCE HttpRequest 在没有打开 Chrome 开发工具的情况下禁用缓存 - FORCE HttpRequest disable cache without Chrome devtools opened 如何检查特殊字符? (谷歌浏览器开发者工具) - How to check for special characters? (Google Chrome DevTools) 如何在 Chrome devtools 中查看 HTTP 缓存使用的空间? - How to view space used by the HTTP cache in Chrome devtools? 在 Chrome DevTools 中禁用源映射 - Disable source maps in Chrome DevTools 禁用 chrome react DevTools 进行生产 - Disable chrome react DevTools for production 在 chrome 中隐藏一些 devtools 标签 - Hide some devtools tabs in chrome Google Chrome - 我如何以编程方式启用 chrome://flags 某些模块从禁用模式到启用模式? - Google Chrome - how can i programmatically enable chrome://flags some of the modules from disable mode to enabled mode? 如何以编程方式在Chrome devtools的“来源”标签中读取文件? - How to read files in Chrome devtools Sources tab programmatically? 如何使用JavaScript将Google Chrome DevTools控制台设置为全屏显示? - How can the Google Chrome DevTools Console be made fullscreen using JavaScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM