title: Is My Page Being Loaded from the Browser Cache?
body: <p>I have a "new items" badge on a page that I want to update immediately the page is loaded from the cache (i.e. when hitting "Back" or "Forward" to return to this page). What is the best way to accomplish this?</p>
  
  <p>The setup is pretty simple. The layout for the app looks for new items every 8 seconds, and updates the badge + list of items accordingly.</p>
  
  <pre><code>$(function() {
      setInterval( App.pollForNewItems, 8000 );
  });
  </code></pre>
  
  <p>When someone navigates away from this page to look at the details of an item, a lot can happen. Things are "new" until <em>any</em> user has viewed them, and the app will likely have several user using it simultaneously (the kind of workflow used for a call center or support tickets).</p>
  
  <p>To make sure that the badges are always up to date, I have:</p>
  
  <pre><code>$(window).bind('focus load', function ( event ) {
      App.pollForNewItems();
  });
  </code></pre>
  
  <p>..And though this works, polling for new items on 'load' is only useful when the page is loaded from the cache. Is there a reliable cross-browser way to tell if a page is being loaded from the cache?</p>