【问题标题】:Chrome Safari ignores no-store cache-control directiveChrome Safari 忽略 no-store 缓存控制指令
【发布时间】: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


【解决方案1】:

这好像和Why does the checkbox stay checked when reloading the page?一样的问题

对我有用的是将autocomplete="off" 添加到页面上的表单元素中。

【讨论】:

    猜你喜欢
    • 2022-12-09
    • 2014-04-24
    • 1970-01-01
    • 2020-07-17
    • 1970-01-01
    • 2019-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多