Sometimes it makes sense to open a document in a new window, so that the new document and the old document are both visible on the user's screen. Perhaps the new document is related to the original so that it makes sense to view both simultaneously. More commonly, the new document may take the user down a new web of documents and you want them to be able to see where they came from.
Regardless of the reason, it is easy to open a new browser window when a link is selected.
All you need to do is add the target attribute to the appropriate <a>
tag.
Normally, the target attribute is used to load a document into a specific frame that
you've previously named. It can also be used to create new windows using one of two methods:
target attribute has not already been
defined as an existing window or frame, a new window will be created with that name and the
desired document will be loaded into that window.
This is the preferred way to create new windows, since you can subsequently use the name to load other documents into the same window. Using this technique, you can load several documents into different windows, controlling which document gets loaded where.
_blank that creates a new window without a name. This has limited usage, since you
cannot load any other documents into that window after it is created. Each usage of _blank
creates a new window.
Some browsers also accept the name _new. If you can't get _blank to
work with your browser, try _new.
Making this work is easy. For example, this link
<a href="http://members.aol.com/htmlguru" target="guru_window">Try it!</a>
opens my HTML Guru home page in a new window named "guru_window".
Try it!
If you reuse that name, the document will replace the current document in that page.
You can load my Hot Tips index into that same window by using the same target name
with the appropriate URL.
Try it!
There are a few other special target names that I'll cover in a future hot tip.
Check back soon!