title: Detecting Browser Back Button after using history.pushState
body: <p>I have a three-stage login form that shows/hides content on the page as progress is made.  When the user proceeds from step 1 to step 2, I call the following:</p>
  
  <pre><code>var stateObj = { foo: "bar" };
  history.pushState(stateObj, "", "");
  </code></pre>
  
  <p>And I see the browser back button enable.  </p>
  
  <p>Now, I'm trying to catch the back button click so I can hide/show content (for example - back to stage 1) accordingly. </p>
  
  <p>How can I detect the browser back button in this scenario?  I don't want the URL to change, I just want to call some JS function when the user hits back.  I am targeting modern desktop/mobile browsers.</p>