【发布时间】:2019-05-01 01:30:22
【问题描述】:
由于某种原因,chrome 一直从缓存中加载 index.html。在开发人员工具的网络选项卡中,我得到 200 Ok(从磁盘缓存加载)。当我禁用缓存或清除缓存时,它会加载 index.html 的新副本。但是这个问题在其他浏览器(例如边缘)中不会发生。我做错了什么?如何强制 chrome 根本不使用缓存,并且总是像我按 F5 时那样获取新副本?这是我的html。
<head>
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="Expires" content="0"/>
<meta http-equiv="Pragma" content="no-cache"/>
</head>
【问题讨论】:
-
我尝试将 content="no-store" 用于缓存控制。没有运气
-
编写一个http拦截器,在你得到服务调用
window.location.reload(true);之前它会删除缓存并重新加载页面。 -
原因很明显,location.reload(),刷新了页面,另外看看这个帖子有few ways,可能会有帮助!
标签: angular google-chrome