2

If you click on a link and it opens in a new tab, in that new tab you have some Javascript that gets the referral url but the referral url equals nothing or undefined.

I want to know if it is possible to get the referral url even when the link has been opened in a new tab.

Kyle B Cox
  • 421
  • 6
  • 18

1 Answers1

1

Yes this is doable. In the new tab's JavaScript you can write

alert(document.referrer);

Know more about Document Referrer.

You can also do this in PHP. Check this Get original URL referer with PHP

Community
  • 1
  • 1
Hari Das
  • 10,145
  • 7
  • 62
  • 59