【发布时间】:2016-07-12 12:53:11
【问题描述】:
我有一个带有复选框的页面和一个指向页面 A 的链接。
我点击复选框, 我点击链接, 转到A页, 点击浏览器后退按钮, 回来吧
我仍然看到复选框被选中,它没有清除。
我使用了正确的缓存控制标头,如下所示。
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-store, no-cache
Expires: 0
另外,试过这个:
document.body.onunload = function(){};
document.body.onpageshow = function(evt) {
if (evt.persisted) {
document.body.style.display = "none";
location.reload();
}
};
在 chrome 和 safari(桌面)中不起作用
在 IE、Firefox、移动 chrome 和 safari 上运行良好。
请帮忙。
【问题讨论】:
-
可能没有使用持久化缓存。但是,由于在导航过程中页面并未从内存中逐出,因此内存中的缓存可能仍处于活动状态。
-
我需要刷新页面。我应该怎么做才能强迫它?同样在网络选项卡中,文档不是从缓存中获取的,我可以验证这一点。但是表格没有被清除。
-
对于 safari,在下面添加解决了这个问题:
标签: google-chrome safari bfcache