11.5. Targeting WindowsThe 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 outsideurl=/" 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 outsideurl=/" 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".
Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|