start page | rating of books | rating of authors | reviews | copyrights

Book HomeWeb Design in a NutshellSearch this book

11.5. Targeting Windows

The problem with the hypertext medium is that when a users click on an interesting link on your page, they might never come back. One currently popular solution to this problem is to make the target document display in a second browser window. In that way, your page is still readily available in the background.

This technique is not without controversy, however. Many users find the loss of control over their browsing experience annoying. Windows users might not even realize a new window has opened in front of their current window if they have their browsers maximized to full screen. So keep both the good and the bad in mind when deciding whether to use pop-up windows.

Use the target attribute of the anchor tag to launch a new browser window for the linked document. Setting the target attribute to "_blank" causes the browser to open a fresh browser window. For example:

<A href="http://www.e-reading.club/" TARGET="_blank">...</A>

If you set every link on your page to target a _blank window, every link will launch a new window, potentially leaving your user with a mess of open windows.

A better method, especially if you have more than one link, is to give the targeted window a specific name, which can then be reused by subsequent links. The following link will open a new window called "display":

<A href="http://www.e-reading.club/" TARGET="display">...</A>

If you target every link on that page to the "display" window, each targeted document will open in the same second window.

The target attribute is most often used in conjunction with framed documents. The syntax and strategy for using the target attribute with framed documents is discussed in Chapter 14, "Frames".

WARNING

Some browsers do not support the target attribute (including WebTV and Internet Explorer 2.0 and earlier). Furthermore, Netscape Navigator 4.0 has a bug that prevents an existing named window from coming to the front. To the user, this looks as though the link did not work since the target document loads into a browser window that is stuck behind the current window.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.