简体   繁体   English

如何排除特定文件在 Chrome 中的缓存。 (如 js 文件)

[英]How to exclude specific file/s from being Cached in Chrome. (like js files)

We are currently developing a website.我们目前正在开发一个网站。 And everytime we edit "user.js" file and to see our updates we need to hard refresh the page which will cause a longer loading time because it will load all the JS, CSS and IMG again from the server.每次我们编辑“user.js”文件并查看我们的更新时,我们都需要硬刷新页面,这将导致更长的加载时间,因为它将再次从服务器加载所有 JS、CSS 和 IMG。 It tooks more than 5 seconds of waiting.等待时间超过 5 秒。

I can't totally disable caching so the pages will much faster 1-3 seconds.我不能完全禁用缓存,所以页面会快 1-3 秒。

My goal now is to know how to disable cache on specific file or files so the rest of the CSS,JS, and IMG files stays cached.我现在的目标是知道如何禁用特定文件或文件的缓存,以便 CSS、JS 和 IMG 文件的 rest 保持缓存状态。

This will give us effeciency in coding.这将使我们在编码方面更有效率。 Any answer is appreciated.任何答案表示赞赏。

For your specific concern, this is what i do.对于您的具体问题,这就是我所做的。

If you wanted to hard refresh this file every time you edit it, and without hard refreshing the whole page.如果您想在每次编辑时硬刷新此文件,而不是硬刷新整个页面。

You just need to hard refresh that specific file您只需要硬刷新该特定文件

https://xdxd.com/user.js

Then open your page normally on new tab , and must be in new tab so the changes will apply.然后在新选项卡上正常打开您的页面,并且必须在新选项卡中才能应用更改。

That's the trick i am doing.这就是我正在做的伎俩。 If ever i dont want to Hard Refresh the whole website.如果我不想硬刷新整个网站。

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

相关问题 是否缓存了.js文件? - Are the .js files being cached? JS适用于Firefox和Safari,但不适用于Chrome。 这是我的网站 - JS works in Firefox and Safari, but not in Chrome. Here's my site flask-assets - 如何防止特定应用程序的静态 js 文件被另一个应用程序使用 - flask-assets - How to keep an specific app's static js files from being used by another app 如何停止IE中缓存的js文件? - How do I stop js files being cached in IE? 是否在html文件中包含no cache meta标签还可以防止该html文件中链接的js和css文件被缓存? - Does including the no cache meta tag in an html file also prevent the js and css files linked in that html file from being cached? 如何排除文件被 tsc 处理? - How to exclude files from being processed by tsc? iframe正在缓存css和js文件 - css and js files are being cached by the iframe Gulp任务将特定的js文件排除在写入Index.html文件之外 - Gulp task to exclude specific js files from writing to Index.html file 如何从缓存中排除特定文件 - How to exclude specific files from caching 如何从Chrome扩展程序的JS文件中调用特定功能 - How to call a specific function from a JS file from a Chrome extension
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM