0

I have created a website, that redirects to another website like so:

<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <title>Site 1</title>
        <meta http-equiv="refresh" content="1;url=http://page2.com">
        <script type="text/javascript">
            window.location.href = "http://page2.com"
        </script>
    </head>
    <body>
        If you are not redirected automatically, click
        <a href='http://page2.com'>here</a>.
    </body>
</html>

Now on the receiving page; page2.com, how can I know if the user came from page1 or some other page? If they come from another source, I dont need to know. I only need to know if they came from my redirect page or not.

user3024235
  • 415
  • 1
  • 5
  • 16

1 Answers1

1
<script>
var x = document.referrer;
alert(x);
if (x == 'http://stackoverflow.com/questions/35236796/knowing-the-source-of-a-website/35236811')
alert('hi stackoverflower');
</script>

Example: http://ec2-52-49-115-131.eu-west-1.compute.amazonaws.com/test.php

PHPDave
  • 904
  • 1
  • 7
  • 15