title: How to detect the back button
body: <p>I've set up a page where I'm using the following code so when you click on a link the content and URL changes without refreshing:</p>
  
  <pre><code>window.history.pushState("object or string", "title", "/photo.php");
  </code></pre>
  
  <p>But when a user clicks on the back button the content doesn't change back. How to detect the back button?</p>