强制重新加载/阻止Web Worker的缓存 [英] Force reload/prevent cache of Web Workers

查看:54
本文介绍了强制重新加载/阻止Web Worker的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,即使您强制重新加载页面(SHIFT + F5等),大多数浏览器(尤其是Chrome)似乎仍在缓存Web Worker脚本.我发现强制更新缓存的唯一可靠方法是在地址栏中键入辅助脚本的路径,然后分别强制重新加载它.

I've noticed that most browsers (Chrome in particular) seem to cache web worker scripts even after you force the page to reload (SHIFT+F5, etc). The only reliable way I've found to force the cache to update is to type the worker script's path into the address bar and force reload it separately.

显然,当尝试开发任何东西时,这都是一种皇家痛苦.有谁知道一种可靠的方法来停止浏览器缓存工作程序脚本或强制其以简单的方式重新加载它们?

Obviously this is a royal pain when trying to develop, well, anything. Does anyone know of a reliable way to either stop the browser from caching worker scripts OR force it to reload them in a simple manner?

推荐答案

您是否尝试过使用 Cache-Control:no-cache HTTP标头来避免完全缓存工作脚本?通常,您可以通过设置适当的HTTP标头来获得所需的缓存行为.

Have you tried using the Cache-Control: no-cache HTTP header to avoid having the worker script cached at all? You can generally get the caching behavior that you want by setting the appropriate HTTP headers.

这篇关于强制重新加载/阻止Web Worker的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆