title: How do I detect if a user has got to a page using the back button?
body: <p>This question is similar to <a href="https://stackoverflow.com/questions/55871/track-when-user-hits-back-button-on-the-browser">Track when user hits back button on the browser</a>, but not the same...  I have a solution and am posting it here for reference and feedback.  If anyone has any better options, I'm all ears!</p>
  
  <p>The situation is that I have a page with an "in place edit", a la flickr.  I.e. there is a "click here to add a description" DIV, which when clicked turns into a TEXTAREA with Save and Cancel buttons.  Clicking Save posts the data to the server to update the database and puts the new description in the DIV in place of the TEXTAREA.  If the page is refreshed, the new description is displayed from the database with a "click to edit" option.  Fairly standard web 2.0 stuff these days.</p>
  
  <p>The issue is that if:</p>
  
  <ol>
  <li>the page is loaded without the description</li>
  <li>a description is added by the user</li>
  <li>the page is navigated away from by clicking a link</li>
  <li>the user clicks the back button</li>
  </ol>
  
  <p>Then what is displayed (from the browser's cache) is the version of the page without the dynamically modified DIV containing the new description.</p>
  
  <p>This is a fairly big problem as the user assumes that their update has been lost and won't necessarily understand that they need to refresh the page to see the changes.</p>
  
  <p>So, the question is: How can you flag a page as being modified after it has loaded, and then detect when the user "goes back to it" and force a refresh in that situation?</p>