1

I am injecting this script in web page and manually clicking in it, but whatsismyreferer shows "no referer".

var a = document.createElement('a');
a.href = 'https://www.whatismyreferer.com/';
a.id = 'dsadasdasd';
a.text = 'referer'; 
document.body.appendChild(a);
j08691
  • 204,283
  • 31
  • 260
  • 272
StackPHPcRoW
  • 61
  • 1
  • 4
  • 1
    A referer is not the text of the link that you clicked. – Bergi Jul 16 '20 at 20:41
  • I see no referrer being set anywhere in your code – j08691 Jul 16 '20 at 20:46
  • Are you running this from a local file? No referer is sent when following a link from a local file. Try putting the code on a webserver. Then you'll see the web page URL. – Barmar Jul 16 '20 at 20:54

1 Answers1

1

This is some code you can inject straight into the url. When you click on the empty link, it will redirect you to the same site you're on, but in a different tab, wait three seconds, and then it will change the url to be https://www.whatismyreferer.com/ and then it will show you what website you were just on. It has been tested. The snippet doesn't work, but that's because there's no window.

var a = document.createElement("a");
a.textContent = "thingy";
a.addEventListener("click", function() {
  var referer = window.open(window.location);
  var timeout = setTimeout(function() {
    referer.window.location = "https://www.whatismyreferer.com/";
  }, 3000);
});
document.body.appendChild(a);
horrible
  • 117
  • 1
  • 8