title: How to get previous URL without going to it?
body: <p>I am working on an application in which the user deals with tickets.
  On each ticket the user can click a "Go Back" button, and is sent to the previous page. </p>
  
  <p>The function is using <em>window.history.back()</em> and verifies before that the history is not empty!
  But, there are two issues to this method :</p>
  
  <p><em>1.</em>    when the user wants to access the ticket via the URL, he firsts has to sign in, then if he clicks on the "Go back" button, he is redirected to the login page.</p>
  
  <p><em>2.</em> when the user comes from an other site, the "Go back" button makes him return to the previous site.</p>
  
  <p>I read a lot about the history things and so, but I did not find any solution to get the previous URL as a string without going to this.
  I also already tried the referrer things without success.</p>
  
  <p>Thank you for your answer!</p>