如何防止在 Google Chrome 中使用元标记进行缓存
How to prevent caching in Google Chrome with meta tags
是否可以通过编程方式阻止 Google Chrome 中的缓存文件?
我想在 chrome 开发者工具中实现与选项 "disable cache" 相同的效果。
主要问题是我正在使用加载另一个脚本的外部脚本(我不能更改它)- 将额外的(随机生成的)参数放入该脚本的源 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 完全忽略了它。
有没有办法做到这一点?
提前致谢。
您可以尝试使用 HTTP 响应 headers,而不是 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?
是否可以通过编程方式阻止 Google Chrome 中的缓存文件?
我想在 chrome 开发者工具中实现与选项 "disable cache" 相同的效果。
主要问题是我正在使用加载另一个脚本的外部脚本(我不能更改它)- 将额外的(随机生成的)参数放入该脚本的源 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 完全忽略了它。
有没有办法做到这一点?
提前致谢。
您可以尝试使用 HTTP 响应 headers,而不是 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?