title: Safari seems to ignore cache settings when user hits back with mouse or keyboard
body: <p>I have a page where once a button is clicked, it is replaced by an Ajax spinner whilst the user waits for the next page to load.</p>
  
  <p>I am controlling (or attempting to control) caching using .htaccess. If the user hits back (browser button, mouse button, alt+left, backspace) it needs to reload the page from the cache. IEs 6-8 and Chrome were all fine with this. Firefox wasn't working for a while and recently started to work, but the problem seems to be remaining in Safari. This seems a little odd, because I'd have expected Safari and Chrome to behave in the same way.</p>
  
  <p>This is my .htaccess file:</p>
  
  <pre><code># Add Proper MIME-Type for Favicon
  AddType image/x-icon .ico
  
  &lt;IfModule mod_expires.c&gt;
      ExpiresActive On
  #   ExpiresDefault A2630000
      ExpiresByType image/x-icon A2630000
      ExpiresByType image/gif A2630000
      ExpiresByType image/jpeg A2630000
      ExpiresByType image/png A2630000
      ExpiresByType application/x-javascript M2630000
      ExpiresByType application/javascript M2630000
      ExpiresByType text/css M2630000
  &lt;/IfModule&gt;
  
  &lt;IfModule mod_headers.c&gt;
      Header set Cache-Control "public"
      &lt;FilesMatch "\.php$"&gt;
          Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0"
      &lt;/FilesMatch&gt;
  &lt;/IfModule&gt;
  
  SetOutputFilter DEFLATE
  
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE application/javascript
  </code></pre>
  
  <p>I've tried it with and without the Cache-Control public line.</p>
  
  <p>I've also tried adding:</p>
  
  <pre><code>AddType application/x-httpd-php .php
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>ExpiresByType application/x-httpd-php A0
  </code></pre>
  
  <p>To no avail.</p>
  
  <p>Am I missing something obvious?</p>
  
  <p>Edit: I don't think it's anything to do with the cache settings.</p>
  
  <p>I've tried adding this to the PHP itself:</p>
  
  <pre><code>#safari test
  if (strstr($_SERVER['HTTP_USER_AGENT'],'Safari')){
      header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
      header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  }
  </code></pre>
  
  <p>And even without those lines I can see in "inspect element" > resources that the right headers are being received. The problem seems to be what Safari is doing with them in its bid to be "the fastest browser". It would appear that it explicitly ignores what the site developers specificy - this sounds like IE's original mindset from back in the day when tables where used for layouts.</p>