By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

HTML Target Attribute

Reference on the HTML Target attribute, what its used for, and useful examples.

Created: 2012-02-25 16:22

The HTML Target Attribute is used to control how links are opened, typically placed on HTML A elements and set to _blank to open links in new windows, rather than the same window.

Try to avoid using this attribute, unless strictly necessary. Opening links in new windows, or changing how links behave normally, can be serious usability issue, and can be quite annoying to users.

A good example would be auction sites, who use _blank, or other mechanisms, to open individual auctions in new windows. This is because some, if not most browsers these days, allow the user to right-click the link and open the link in another tab. Many users open a bunch of links in new tabs, and then look at them one-by one. This is also nice if the user has a slow connection, or the pages otherwise take a long time to load, in that it allows the user to read other pages on a site while waiting for the other tabs or windows to load.

Possible values

_blankOpens the link in a new Window
_parentOpens the link in a parent frame
_selfOpens the link in the same frame
_topOpens the link in the top frame
framenameWhatever frame with its name attribute set to whatever you type in.

HTML Target Attribute Example

<a href="http://brugbart.com/" target="_blank">Brugbart.com - Tutorials and References</a>