Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript document.referrer

Tags:

javascript

I've got two webpages one

<html>
  <body>
    <p><a href="page2.html">Link</a></p>
  </body>
</html>

And the second page.

<html>
  <body>
    <script type="text/javascript">
      document.write(document.referrer);
    </script>
  </body>
</html>

The second page is always blank, it doesn't seem to be picking up the referrer, any idea's why?

like image 707
Ali Beasley Avatar asked Jan 25 '26 06:01

Ali Beasley


1 Answers

In IE, document.referrer works only for http:// resources, not https:// and file:// ones. Maybe that is your problem.

Edit: There are even more cases in which IE doesn't pass it on.

like image 92
Pekka Avatar answered Jan 26 '26 19:01

Pekka