ptg16476052
Working with Linked Windows 557
20
Working with Linked Windows
Before you learn how to use iframes, you need to learn about the target attribute of the
tag. It enables you to direct a link to open a page in an inline frame or a new win-
dow. This attribute takes the following form:
target="browsing_context"
To drop a bit of jargon on you, the value of the target attribute is the name of a brows-
ing context. Usually, when you click a hyperlink, the page to which you’re linking
replaces the current page in the browser window. When you use the target attribute, you
can open links in new windows, or in existing windows other than the one that the link is
in. With frames, you can use the target attribute to display the linked page in a different
frame. There are also some keywords you can use that represent browsing contexts by
function rather than name.
Browsing Context Keywords
The target attribute works not only with window names but also with keywords that
represent a type of context. All of these keywords are case sensitive and begin with an
underscore (_) character. They enable you to target links at specific browsing context
relative to the current browsing context.
Table 20.1 lists the browsing context keywords and describes their use.
TABLE 20.1 Magic target Names
target Name Description
target="_blank" Forces the document referenced by the tag to be loaded into a
new unnamed window.
target="_self" Causes the document referenced by the tag to be loaded into the
current browsing context—the window or frame that contains the
tag. This is the default behavior of links.
target="_parent" Specifically for use with frames. Forces the link to load into the par-
ent of the current browsing context. If the current document has no
parent, however, target="_self" will be used.