I can never remember what the differences are between noopener
, noreferrer
, and nofollow
, or when best to use them, so here's a handy guide that covers pretty much all of the basics.
Tl;dr:
- All three are values for the
rel
attribute on<a>
tags; - There's no point using any of them unless you have
target="_blank"
set (i.e. the link will force a new tab to open), and if you do you should usenoopener
to reduce cross-site phishing risks (there's no downside); - Their primary goal is to restrict the access the linked page has to your website/the page linking to it;
noreferrer
blocks analytics tracking, which you probably don't want to do (but I guess is a way to subtweet via the indie web 😂). It also prevents SEO cross-linking scores, so if you really hate a linked website and don't want to boost it in search, then use this value;- Ditto
nofollow
, though this is relevant regardless of what the target is; it just stops search engine crawlers from traversing the link, so ideal if you have it go somewhere you don't want associated with your site or search indexed, or if the link is doing fancy stuff (i.e. it should be a button 😉). There's a valid point here that user-generated content (such as comments) can benefit from applyingnofollow
by default, to reduce spam efficacy; - Apparently,
nofollow
is a requirement for sponsored links and ads, so you don't generate clickthrough revenue based on spiders.
(PS: the article's own tl;dr is arguably even more concise and worth a read)