Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

target — navigation destination

The `target` attribute selects where a destination document opens: in the current context, a new tab or window, or a named frame. It applies to hyperlinks and forms; the `base` element can establish a document-wide default target.

Version: WHATWG HTML Living Standard; index snapshot date recorded separately

Syntax

target="_self|_blank|_parent|_top|name"

target selects a navigation context, not a resource address. On a and area, it specifies the hyperlink destination context; on form, it specifies where the submission result is displayed. The addresses come from href and action, respectively. It is not a global attribute.

The keyword _self means the current context; _blank requests a new top-level context, usually a tab or window; _parent selects the immediate parent; and _top selects the top-level context. Without a parent, the last two behave like _self. These keywords are ASCII case-insensitive. Browser settings and sandbox restrictions can alter or block navigation; _blank does not guarantee a tab rather than a window.

A name such as preview can select an iframe through its name, not its id. If no available target has that name, the browser may create a new window or tab. Names must not start with _, because that prefix is reserved for keywords.

base target establishes the default for hyperlinks and forms; an explicit target overrides it. A form's submit button can override both through formtarget. Without these settings, the current context is used. A document may contain only one base; when it has target, it must precede hyperlinks.

For a, area, and form, _blank provides noopener behavior by default unless rel="opener" is explicitly requested. You can express isolation with rel="noopener"; rel="noreferrer" additionally suppresses referrer information. noopener also affects reuse of named targets other than _self, _parent, and _top, treating them like _blank when choosing a new context.

Examples

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Named target</title>
</head>
<body>
  <p><a href="about:blank" target="preview">Clear preview</a></p>
  <iframe name="preview" title="Preview" srcdoc="<p>Ready</p>"></iframe>
</body>
</html>

Result

Initially: Ready appears inside the frame.
After activating Clear preview: the frame is blank; the outer page remains visible.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources