title: Previous history that isn't same URL
body: <p>I have a back button on my page and when you do a refresh on the page, the same URL gets added to the back history.</p>
  
  <p>What I want to know is if there is anyway that when you click the back button, it doesn't go back to the page with the same URL but goes back to a page that doesn't have the same URL.</p>
  
  <p>The site is also using ui-router if that helps.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>It seems that I explained this pretty poorly, so here's a longer explanation.</p>
  
  <p>On a few of our pages throughout our site we have back buttons that use <code>history.back()</code> or <code>history.go(-1)</code> to take the user back to the previous page that they were on, but if the user were to refresh the page this page will be added into the browser history and the user would have to then click the back button X amount of times depending on how many refreshes they did.</p>
  
  <p>What I want to know how to do - if possible - is that if the user clicks the back button, is there some type of way to do a comparison between the array of URLs in the previous history and check against the current pages URL and redirect the user to a previous page that doesn't equal the current pages URL.</p>
  
  <p>The <code>history.back()</code> and/or <code>history.go(-1)</code> can be replaced with something else or if there might something more structural that can be done beforehand that would be better.</p>