The target attribute names the browsing context (tab, window, or <iframe>) where a linked URL or form response should open. On <a>, it works with href.
Also used on <form>, <base>, and image-map areas. Submit buttons can override with formtarget. Pair new-tab links with clear text and often rel.
Baseline · Widely available.
Not deprecated. Standard attribute for links and forms across modern browsers. Default when omitted is the current context (_self).
Warn users before _blank.
Per MDN: unexpected new tabs confuse many people. Put “(opens in new tab)” (or similar) in the link text when you use target="_blank".
Syntax
HTML Syntax
syntax.html
<a href="…" target="name">
name is a keyword (_self, _blank, …) or a custom browsing-context name (e.g. an iframe’s name). Equivalent JS: a.target = "_blank".
Short, copy-ready snippets. Use Try It Yourself for a live editor.
Example 1 — Open in the Same Tab
Default behavior — stay in the current browsing context.
HTML
<a href="https://example.com/" target="_self">
Example site
</a>
<!-- Omitting target is the same as _self -->
<a href="https://example.com/">Example site</a>
Match names:target="preview" needs <iframe name="preview">.
_parent goes one frame up; no parent → acts like _self.
_top replaces the outermost page — useful to escape nested iframes.
Always set title on iframes for accessibility.
Edge Cases & Pitfalls
Most issues are surprise new tabs, missing link text warnings, or opener security on older browsers.
a11y
Announce new tabs
Say “(opens in new tab)” in the visible link text — icons alone are not enough without accessible names.
security
noopener and _blank
Modern browsers imply noopener for a[target=_blank]. Explicit rel="noopener" remains a good habit for clarity and older engines.
popup
User settings win
_blank often means a tab, but browsers/users may open a window instead. Don’t assume UI chrome.
forms
Form vs button override
target on <form> sets the default; formtarget on a submit control can override it.
base
<base target> is global
A <base>target changes the default for the whole document — use carefully.
Compatibility
Browser Support
target is an HTML attribute for links and forms in the browser. It is not a Node.js, Deno, or Bun API.
✓ Widely available
target
Supported everywhere for a, form, area, and base. Accessibility quality depends on how you use _blank.
98%Global support (approx.)
Google ChromeAll modern
Full support
Mozilla FirefoxAll modern
Full support
Apple SafariAll modern
Full support
Microsoft EdgeAll modern
Full support
OperaAll modern
Full support
Samsung InternetModern
Full support
Internet ExplorerAll
Supported
targetWidely supported
Bottom line: Safe to use. Prefer _self by default; when using _blank, warn in the link text and keep rel="noopener".
Remember
Key Takeaways
Role: choose where a link/form result opens.
Default:_self (same context) when omitted.
_blank: warn in text; keep rel="noopener".
Frames: named targets, _parent, and _top.
One line:target picks the tab/frame — default same page; new tabs need a clear warning.
Frequently Asked Questions
It names the browsing context (tab, window, or iframe) where the linked URL or form response should open. On links, common values are _self (same tab) and _blank (new tab).
Mainly a, area, form, and base. Forms also have formtarget on submit buttons for a per-button override.
Same as target="_self": the link or form result loads in the current browsing context.
Older pages needed rel="noopener" (and often noreferrer) because a new page could use window.opener. Modern browsers treat target="_blank" on anchors as implicitly noopener. Explicit rel="noopener" is still a clear, portable habit.
No. Opening a new tab can surprise users. Prefer _self unless there is a clear reason, and warn in the link text when you do use _blank (MDN accessibility guidance).
_parent loads in the parent frame; _top loads in the topmost frame. With no frames, both behave like _self. Useful inside iframes.