title: How do I make Firefox reload page when back button is pressed?
body: <p>I have tried every combination and permutation of meta tags that are supposed to stop a page from being cached, but Firefox STILL caches the page!  <strong>I just need the URL to reload when a user presses the back button.</strong>  Works fine in IE8.</p>
  
  <p>I have tried all of these...</p>
  
  <pre><code>&lt;meta http-equiv="Cache-Control" content="no-store" /&gt;
  &lt;meta http-equiv="Pragma" content="no-cache"/&gt;
  &lt;meta http-equiv="Expires" content="-1"/&gt;
  &lt;meta http-equiv="Expires" content="Sat, 1 Jan 2000 00:00:00 GMT" /&gt; 
  </code></pre>
  
  <p>...and I have also tried the following JavaScript...</p>
  
  <pre><code>&lt;input type="hidden" id="refreshed" value="no"/&gt;
  &lt;script type="text/javascript"&gt;
  
      onload=function(){
          var e=document.getElementById("refreshed");
          if(e.value=="no"){
              e.value="yes";
          }
  
          else{
              e.value="no";
              location.reload();
          }
  
      }
  
  &lt;/script&gt; 
  </code></pre>
  
  <p>... all to no avail.  What am I missing here?  Pages are generated with PHP if that matters.</p>
  
  <p><strong>UPDATE 1:</strong></p>
  
  <p>I have tried every suggestion thus far but I still cannot get this to work.  When I use Chris's PHP code I use it like this...</p>
  
  <pre><code>&lt;?php
  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
  ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;!--the rest of my page--&gt;
  </code></pre>
  
  <p>.. and as you can see it is at the EXTREME top of my webpage, before the <code>DOCTYPE</code> header.</p>
  
  <p>I have also experimented with <code>session_start()</code> but even after reading the manual I am not sure I am using it right.  I was putting it right at the very top of my page as well.</p>
  
  <p><strong>I am open to ANY SUGGESTIONS that make this work without breaking other page functionality.  I know I have seen pages that reload EVERY TIME the back button is used, HOW ARE THEY DOING IT?!</strong></p>
  
  <p><strong>SOLVED!</strong></p>
  
  <p>Turns out I had multiple issues working against me, but through due diligence I was able to eliminate those issues and emerge victorious.</p>
  
  <p>After Chris updated his code to...</p>
  
  <pre><code>&lt;?php
  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
  echo time();
  ?&gt;&lt;a href="http://google.com"&gt;aaaaaaaaaaaaa&lt;/a&gt;
  </code></pre>
  
  <p>I found that his code did indeed work when I used it EXACTLY how he had it with NOTHING else, but when I put it into my pages it didn't work.  All of my pages are either <code>.php</code> or <code>.html</code> and all are attached to a DWT (Dynamic Web Template), so I was updating all of them at once with Chris's code.  What I didn't realize was that the DWT starts RIGHT AFTER the <code>DOCTYPE</code> header, so the code was never inserted into my pages.  I could find no way to make the DWT include the <code>DOCTYPE</code> header so I went into all my pages and manually inserted the code above the <code>DOCTYPE</code> header.</p>
  
  <p>Next I found that even though my server is set to parse <code>.htm</code> and <code>.html</code> as <code>.php</code> the <code>.html</code> pages were generating an error at the very where I had inserted Chris's code saying something to the effect of "cannot modify headers, headers have already been sent".  I didn't really care what my extensions were so I just changed all my <code>.html</code> extensions to <code>.php</code> extensions.</p>
  
  <p>A final minor annoyance was that even though the page was now not being cached (just like I wanted) Firefox was placing the user at their last location on the previous page when they used the back button (i.e. if a user was at the bottom of page a when they navigated to page b, then the user used the back button on page b they would be returned to the bottom of page a, not the top of page a as desired).  Trimming down my original JavaScript fixed this...</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  
          onload=function(){
              document.getElementById('content').scrollTop=0;
          }
  
      &lt;/script&gt;
  </code></pre>
  
  <p>Even though this seems very involved for such a simple problem I am glad it is fixed.  Thanks for your help  everyone (especially Chris).</p>