javascript - Knowing the Source of a website? -
this question has answer here:
- how previous url in javascript? 5 answers
i have created website, redirects website 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 not redirected automatically, click <a href='http://page2.com'>here</a>. </body> </html>
now on receiving page; page2.com, how can know if user came page1 or other page? if come source, dont need know. need know if came redirect page or not.
<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
Comments
Post a Comment