【问题标题】:How to prevent caching in Google Chrome with meta tags如何使用元标记防止 Google Chrome 中的缓存
【发布时间】:2015-11-10 12:19:00
【问题描述】:

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

我想实现和chrome开发者工具中的“禁用缓存”选项一样的效果。

主要问题是我正在使用加载另一个脚本的外部脚本(我无法更改它) - 将其他(随机生成的)参数放入该脚本的源 url 将无济于事。

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

<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 caching browser-cache meta-tags


    【解决方案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?

    【讨论】:

      猜你喜欢
      • 2014-09-13
      • 2017-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-14
      • 1970-01-01
      • 2020-11-18
      • 2016-06-24
      相关资源
      最近更新 更多