Issue #50 · important
Issue 50
What is this issue?
When you link to external websites and set the link to open in a new tab (target="_blank"), you should include the rel="noopener noreferrer" attribute. This issue checks whether all external links that open in new tabs have these security attributes properly set.
A passing implementation requires:
- All external links with
target="_blank"includerel="noopener noreferrer" - Both
noopenerandnoreferrertokens are present (not just one) - The
relattribute is properly formatted with correct spelling
Example: A link to an external site: <a href="https://example.com" target="_blank" rel="noopener noreferrer">Visit Example</a>
Why does it matter?
Proper rel attributes for external links are important because they:
- Improve Security: Prevent reverse tabnabbing attacks where the external page can manipulate your page through
window.opener - Protect Privacy: Prevent sending referrer information to external sites when
noreferreris used - Follow Best Practices: Modern browsers recommend these attributes for all external links opening in new tabs
- Protect User Experience: Prevent external pages from being able to redirect your page to a malicious URL
While this issue doesn't directly impact rankings, it's considered a best practice for website security and user privacy, which indirectly supports your overall SEO health score.
How to fix it
-
Audit your external links: Check all links that have
target="_blank"and ensure they includerel="noopener noreferrer". -
Add missing attributes: For each external link opening in a new tab, update the HTML to include both tokens:
<a href="https://external-site.com" target="_blank" rel="noopener noreferrer" >Link Text</a > -
Update templates and components: If you use shared templates or components for external links, update them to automatically include these attributes.
-
Check for partial implementation: Ensure you're not missing one of the two tokens (some sites only have
noopenerbut notnoreferrer, or vice versa). -
Test after changes: After making changes, re-crawl your site to confirm all external new-tab links now have proper
relattributes.
Examples
Example 1: Missing rel Attribute
Problematic State (Fails): An external link opens in a new tab without security attributes:
<a href="https://external-site.com" target="_blank">Visit External Site</a>
Corrected State (Passes):
Add both noopener and noreferrer tokens:
<a href="https://external-site.com" target="_blank" rel="noopener noreferrer"
>Visit External Site</a
>
Example 2: Missing One Token
Problematic State (Fails): Only one token is present:
<a href="https://external-site.com" target="_blank" rel="noopener"
>Visit External Site</a
>
Corrected State (Passes): Include both tokens:
<a href="https://external-site.com" target="_blank" rel="noopener noreferrer"
>Visit External Site</a
>
Example 3: Internal Links (No Issue)
No Issue (Passes):
Internal links don't require noopener noreferrer:
<a href="/contact" target="_blank">Contact Us</a>
This is fine because it's an internal link (same domain).
How PixyScan detects this
PixyScan performs external link security checks through the following logical steps:
-
Link Extraction: PixyScan crawls your pages and extracts all external links (links pointing to different domains).
-
Target Filtering: PixyScan filters for external links that have
target="_blank"attribute (links that open in new tabs). -
Rel Attribute Check: For each external link with
target="_blank", PixyScan checks therelattribute to verify it includes both:noopenertokennoreferrertoken
-
Token Validation: PixyScan parses the
relattribute value and checks for the presence of both required tokens (case-insensitive). -
Issue Identification: PixyScan raises issues when:
- External links with
target="_blank"are missing therelattribute entirely (SUGGESTION) - External links are missing one or both required tokens (SUGGESTION)
- External links with
Note: PixyScan analyzes links in raw HTML only and does not execute JavaScript. Links generated only by JavaScript cannot be detected for this check.