Content · Web Development · HTML

HTML target="_blank" and Tabnabbing Protection

Learn target="_blank" and tabnabbing protection with a clear explanation, practical HTML markup, a walkthrough and common mistakes to avoid.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

A small piece of HTML can change what a visitor sees or how the browser understands a page. In this lesson, you will explore target="_blank" and tabnabbing protection using a short example that you can inspect and change.

The Idea in Plain English


Using rel="noopener" prevents a newly opened page from getting a window.opener reference to the opening page. Modern browsers generally provide this protection implicitly for target="_blank", but an explicit value documents intent.

You can test this using a small local HTML file. Change one part at a time and check the result in the browser before adding more code.

A Working Example


Read the sample once before copying it. Notice the element names and attribute values, then compare them with the explanation below.

<a href="https://example.net/catalog"
   target="_blank" rel="noopener noreferrer">
    Open the catalog in a new tab
</a>

What Each Part Does


  • The anchor is a link when its href points to a destination.
  • href is the URL or fragment destination of a link.
  • rel describes the relationship between the current page and a linked resource.

The linked page opens in a new browsing context without access through window.opener.

Keep the example small while learning. Once it behaves as expected, try it inside a larger page and make sure the URLs, files and surrounding HTML are correct.

Try It Yourself


Try this next: write a new-tab anchor with rel=noopener. Then inspect the page and explain what changed.

Common Beginner Mistakes


  • Assuming noreferrer and noopener do exactly the same thing: noreferrer additionally suppresses referrer information.
  • Copying the code without checking whether its linked files or endpoints exist; sample addresses and file paths need real resources.
  • Choosing a tag only because its default appearance looks right, without checking whether it describes the content correctly.

Key Takeaways


  • Using rel="noopener" prevents a newly opened page from getting a window.opener reference to the opening page. Modern browsers generally provide this protection implicitly for target="_blank", but an explicit value documents intent.
  • The linked page opens in a new browsing context without access through window.opener.
  • Test the markup in a browser, and check accessibility and real-world behavior where relevant.
Share this resourceSend this page to someone who may find it useful.