Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One answer: Among other things, <strong>unload events cause the back/forward cache to be invalidated</strong>.</p> <p>Some browsers store the current state of the entire web page in the so-called "bfcache" or "page cache". This allows them to re-render the page very quickly when navigating via the back and forward buttons, and preserves the state of the DOM and all JavaScript variables. However, when a page contains onunload events, those events could potentially put the page into a non-functional state, and so the page is not stored in the bfcache and must be reloaded (but may be loaded from the standard cache) and re-rendered from scratch, including running all onload handlers. When returning to a page via the bfcache, the DOM is kept in its previous state, without needing to fire onload handlers (because the page is already loaded).</p> <p>Note that the behavior of the bfcache is different from the standard browser cache with regards to Cache-Control and other HTTP headers. In many cases, browsers will cache a page in the bfcache even if it would not otherwise store it in the standard cache.</p> <p><del>jQuery automatically attaches an unload event to the window, so unfortunately using jQuery will disqualify your page from being stored in the bfcache for DOM preservation and quick back/forward</del>. [Update: this has been fixed in jQuery 1.4 so that it only applies to IE]</p> <ul> <li><a href="https://developer.mozilla.org/En/Using_Firefox_1.5_caching" rel="noreferrer">Information about the Firefox bfcache</a></li> <li><a href="http://webkit.org/blog/427/webkit-page-cache-i-the-basics/" rel="noreferrer">Information about the Safari Page Cache</a> and <a href="http://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/" rel="noreferrer">possible future changes to how unload events work</a></li> <li><a href="http://www.opera.com/support/kb/view/827/" rel="noreferrer">Opera uses fast history navigation</a></li> <li>Chrome doesn't have a page cache (<a href="http://code.google.com/p/chromium/issues/detail?id=2879" rel="noreferrer">[1]</a>, <a href="http://code.google.com/p/chromium/issues/detail?id=48657" rel="noreferrer">[2]</a>)</li> <li>Pages for playing with DOM manipulations and the bfcache: <ul> <li><a href="http://www.twmagic.com/misc/cache.html" rel="noreferrer">This page will be stored in the regular cache</a></li> <li><a href="http://www.twmagic.com/misc/cache-nocache.html" rel="noreferrer">This page will not, but will still be bfcached</a></li> </ul></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload