How to prevent content being displayed from Back-Forward cache in Firefox?

前端 未结 4 1994
既然无缘
既然无缘 2020-12-03 11:42

Browser: Firefox 6.0

I\'ve Page A with the following setup to make sure the content is NOT stored in the bfcache of the browser:

1) $

4条回答
  •  庸人自扰
    2020-12-03 12:29

    The answer below does not work any more:

    From answer on SO, adding an unload event to window causes the back/forward cache to be cleared.

    UPDATE. POSSIBLE SOLUTION:

    BFCache can bring surprises to developers, because at least in Firefox when moving back/forward the page does not refresh even if it was told by HTTP headers. So it's better to assume that the page will not refresh.

    On the other hand, what is the difference between getting page with outdated data because of BFCache, and finding a tab in your browser that you did not reload for ages?

    If you care about those kind of things, write some javascript that checks server for updates and reloads sensitive information. This is a chance to turn your problem into win ).

提交回复
热议问题