HTML and CSS Reference
In-Depth Information
17.4. Tricks with Windows and Frames
For the vast majority of links in your documents, you'll want the newly
loaded document displayed in the same window, replacing the previous
one. That makes sense because your users usually follow a sequential
path through your collection.
But sometimes it makes sense to open a document in a new window so
that the new document and the old document are both directly access-
ible on the user's screen. If the new document is related to the origin-
al, for instance, it makes sense to have both in view. Other times, you
might want to open more than one document in multiple windows in a
frameset. More commonly, the new document starts the user down a new
web of documents, and you want her to see and remember where she
came from.
Regardless of the reason, it is easy to open a new browser window from
your document. All you need to do is add the target attribute in the ap-
propriate hyperlink ( <a> ) tag.
17.4.1. Targeting Windows
We normally use the target attribute to load a document into a specific
frame that we've named in a frameset. It also serves to create a new
window, by one of two methods:
Reference a new name
If you use a name you haven't previously defined as the value for
the target attribute of a hyperlink, the popular browsers automat-
ically create a new window with that name and load the referenced
document into that window. This is the preferred way to create new
windows because you can subsequently use the name to load oth-
er documents into the same window. Using this technique, you can
control which document gets loaded where.
Search WWH ::

Custom Search