title: Add a URL to browser back button
body: <p>I'm trying to set a URL on the browser back button.  I've looked at a few examples and found this code and it works.  The problem is when I click on an anchor button it does the same as when I click on the browser back button.. this is not good. I believe the problem is with this line of code - I could be wrong -  </p>
  
  <pre><code>window.addEventListener('popstate', function(event){ ... })
  </code></pre>
  
  <p>Here's the code -  </p>
  
  <pre><code>history.pushState(null, null, '&lt;?php echo $_SERVER["REQUEST_URI"]; ?&gt;');
  window.addEventListener('popstate', function(event) {
          window.location.assign("http://newurl.com");
  });
  </code></pre>
  
  <p>I've been working on this all day and cannot find a solution.  Can someone help?  </p>