Search code examples
google-chromesafaribfcache

Chrome Safari ignores no-store cache-control directive


I have a page with a checkbox and a link to page A.

I click on the checkbox, I click on the link, go to page A, click browser back button, come back

I still see the checkbox checked, it's not clearing up.

I have used proper cache-control headers as below.

Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-store, no-cache
Expires: 0

Also, tried this:

document.body.onunload = function(){};
    document.body.onpageshow = function(evt) {
        if (evt.persisted) {
        document.body.style.display = "none";
        location.reload();
        }
    };

Nothing works in chrome and safari (desktop)

Works well on IE, Firefox, mobile chrome and safari.

Please help.


Solution

  • This seems to be the same problem as Why does the checkbox stay checked when reloading the page?

    What worked for me was to add autocomplete="off" into the form element on the page.