target="blank" vs target="_blank": the missing underscore matters

A missing underscore in the target attribute is easy to miss, and it looks like a plain typo: the value should begin with an underscore, as in target="_blank".

<a target="_blank" href="https://codepen.io">
  Open CodePen in a New Tab
</a>

That version has the correct syntax. But with target="blank" and no underscore, blank is only a name — it could be anything, such as target="foo" or something that describes what is happening, like target="open-new-links-in-this-space".

The difference between the two comes down to what happens on later clicks:

  • target="_blank" is a special keyword that opens links in a new tab every time.
  • target="blank" opens the first-clicked link in a new tab, but any future links that share target="blank" open in that same newly opened tab.

The author credits this tweet explanation for the finding and built a very basic demo page to show the behavior (code). In the demo, a new tab opens on the first link click; later clicks, including ones made from that new tab, also open a link into it.

Why?

Use cases are described as few and far between, and the author isn't much of a fan of target="_blank" in the first place. One imaginable case is documentation: in a web app where people actively work, links to docs could open in a new tab so users don't navigate away from active work — without spawning a new tab for every documentation link.

<a target="codepen-documentation" 
  href="https://blog.codepen.io/documentation/">
  View CodePen Documentation
</a> 

<!-- elsewhere -->

<a target="codepen-documentation" 
  href="https://blog.codepen.io/documentation/">
  About Asset Hosting
</a>