如何使用元标记阻止Google Chrome中的缓存

时间:2015-11-10 12:19:00

标签: google-chrome caching browser-cache meta-tags

是否可以通过编程方式阻止在Google Chrome中缓存文件?

我希望获得与选项相同的效果"禁用缓存"在chrome开发人员工具中。

主要问题是我使用外部脚本(它不能由我更改)加载另一个脚本 - 将额外的(随机生成的)参数放入源脚本中以获得该脚本不会受到影响帮助

到目前为止,我已尝试使用元标记:

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1990 12:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

使用该标记的不同组合进行测试后,我只能说Google Chrome完全忽略了这一点。

有没有选择呢?

提前致谢。

1 个答案:

答案 0 :(得分:1)

您可以尝试使用HTTP响应标头,而不是HTML元标记:请参阅Disabling browser caching for all browsers from ASP.NET

如果您要求禁用输入元素中的数据缓存,请参阅How to prevent google chrome from caching my inputs, esp hidden ones when user click back?