target (HTML attribute)

Spec
Depr. Version
Yes HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

target=" { _blank | frame name | _parent | _self | _top } "

Description

The target attribute is deprecated and its use as a layout mechanism, like that of the frameset, is no longer common. However, if you do find yourself having to maintain a frameset-based web site, you may need to open links in frames or windows other than the one in which the source of the link resides.

Example

Here, the target attribute for the a element is set to "_top":
<p>You can try our <a href="cakes.html" target="_top">lovely range
    of cakes</a>.</p>

Value

The attribute can take any of the following values:

  • "_blank"

    loads content in a completely new window

  • "frame name"

    loads content in a frame with a custom name

  • "_parent"

    loads content in the parent frameset for the current frame

  • "_self"

    loads content in the same frame (This attribute isn’t normally required, as this is the default behavior unless the baseelement specifies otherwise. In that case, you’d need to override the specification using "_self"; for example, <base target="searchresults"/>.)

  • "_top"

    loads content in the top-level frameset (in effect, the whole browser window), no matter how many nested levels down the current frame is located

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

It causes no compatibility issues, and has excellent support across all tested browsers.

Note that many browsers open new windows in a new tab in the browser interface rather than a entirely separate window, but this still qualifies as ‘a pass’.

User-contributed notes

There are no comments yet.

Related Products