Use HTML Target Attribute to Specify Where to Open Document
By Stephen Bucaro
When a user clicks on a link, they are taken to the document pointed to
by the URL (Uniform Resource Locator) in the href attribute in the link.
By default the contents of the current browser window is replaced by that document.
however, you can open the page in a different window as specified by the target
attribute in the link.
_blank
In the link shown below, the target attribute is set to "_blank", which causes
the linked document to open in a new window. This means two browser windows
will be open.
<a href="http://bucarotechelp.com" target="_blank">Bucaro TecHelp</a>
Bucaro TecHelp
_top
In the link shown below, the target attribute is set to "_top", which causes
the linked document to open in the main browser window. This means only one
browser window will be open. This is the default operation.
<a href="http://bucarotechelp.com" target="_top">Bucaro TecHelp</a>
Bucaro TecHelp
The target attribute was primarily designed to work with frames.
Frames are a method that could be used for layout. Frames consist of a document
containing the frameset code. A frameset can contain frames and nested framesets.
The code shown below defines a frameset which contains a frame and a
nested frameset, the nested frameset contains two frames. Note that each frame
has a src attribute which defines the webpage to be loaded into each frame.
<frameset rows="50,*">
<frame src="frame1.htm" />
<frameset cols="50%,50%">
<frame src="frame2.htm" />
<frame src="frame3.htm" />
</frameset>
</frameset>
frame 2 and frame 3 are in child frameset
_self
In the link shown below, the target attribute is set to "_self", which causes
the linked document to be loaded into the same window or frame that the document
containing the link is in.
<a href="http://bucarotechelp.com" target="_self">Bucaro TecHelp</a>
Bucaro TecHelp
|