target Attributetarget AttributeThe target attribute specifies the window or frame in which the author
would like the href
URI of a link
or the action URI of a form to be
loaded. If specified on the base element, this attribute sets
the desired default behaviour for all links or forms in the document.
This default behaviour may of course
be overridden by target attributes on the individual links or forms themselves.
Until recently, the target attribute was not passing W3C Validation
but, now that it is (as at 15th April 2009, anyway) I have included the documentation on this site.
The target attribute may be assigned one of the following reserved words:
target attribute is omitted both from the link and from the document's
base element, if it exists.Otherwise, the value of the target attribute is treated as a target name and if a frame with that target name exists
then the URI is loaded in that frame, replacing the existing document.
Otherwise, the URI is loaded in a new window which is assigned that target name; if the user subsequently follows
another link with that same target name, the target URI will also be loaded in this window, replacing the existing document.
The HTML 4.01 specifications say that all target names should begin with a letter, i.e. [a-zA-Z],
and that all other names should be ignored by user agents (ref:
*HTML 4.01 - Frame target names).
In practice, this isn't always the case.
Also, Internet Explorer has defined two additional values "_search" and "_media" which are specific
to IE and indicate that the link should be opened in the search pane or the media bar respectively.
For example, the following link should be opened within a new browser window (or tab, depending on the browser and on the user's settings):
This is rendered as:
Note:
Having said all this, it is probably best in most circumstances to avoid the target attribute and let the user decide on where to
open a particular link. However, as long as it's used with a bit of common sense, I don't see the need to ban its use entirely.
Also, bear in mind that the use of target="_blank" in particular can often be overridden
in user preferences, for example in Firefox by setting the
preference browser.link.open_newwindow to 1 - see
*trilithium.com - The folly of target="_blank" for a discussion.