Document.referrer wrong when pressing the back button
<p>I have a php/javascript page that automatically logs a user into different systems from one log on.  These are external sites and all works good except when the user hits the back button.  It then redirects them right back where they came from.  I'm looking to have it redirect back to my main website and avoid getting stuck in this redirect nightmare. So I tried document.referrer but it only seems to grab the current page I am on and not the referred site.  Am I wrong or can this not be done like this.</p>

<pre><code> &lt;script type="text/javascript"&gt;
 function myfunc () {
 var frm = document.getElementById("loggedin1");
  if(document.referrer != 'https://someurl')
  {
  alert(document.referrer);//Just used to see output
  frm.submit();
  }
  }

  window.onload = myfunc;

  &lt;/script&gt;
</code></pre>

<p>If I could get it to function I would add an else in there and have it going back to my website.</p>

<p>Thanks!</p>
