I need to open a link from within jQuery but i need to avoid sending the referral information. In shorter words, i need to simulate rel="noreferrer"
Is it feasible?
I need to open a link from within jQuery but i need to avoid sending the referral information. In shorter words, i need to simulate rel="noreferrer"
Is it feasible?
I think every browser out there automatically tacks this information onto all requests, and there's no way to directly modify it with JavaScript.
After scouring the web, you do have a couple of options though:
All options are ugly and I wouldn't recommend them for usability reasons. I'm basing this off of an old Google Answers question, but I think the answers stand.
You might have jQuery write a link with the rel attribute set to noreferrer, then call it with $(link_you_made).click().
Not sure exactly what you mean by opening a link "from within jQuery", but setting window.location directly won't pass any referrer information.
So if you have a link that you want to pass no referral information you could do something like this:
$("a").click(function() { window.location = $(this).attr("href"); return false; });
Edit: Just did some testing & it looks like Firefox actually does pass referrer information through with a window.location change. So unfortunately this is not a complete/cross-browser solution...
Also as sczizzo points out in the comment below, there may be times where this won't be reliable (for example, I'm not sure if/how click fires when you middle click a link in Firefox to open it in a new tab).