A link, by default, opens in the same window or frame that contains the link. You can choose another target for each link individually, as described on page 108, or specify a default target for all the links on a page. Figure 6.14. Use the base tag to set the default target (in this case the characters window) in order to save typing. Notice that I no longer have to specify the target for the links in the first paragraph. This document is equivalent to the one shown in Figure 6.11. To set a default target for a page: 1. | In the head section of your Web page, type <base. | 2. | Type target="title", where title is the name of the window or frame in which all the links on the page should open, by default. | 3. | Type /> to complete the base tag. | Tips Target names are case sensitive! In addition, you should always enclose them in quotation marks. You can override the default target specified in the base tag by adding a target attribute to an individual link (see page 108). While the base tag is part of (X)HTML strict, the target attribute is not. I use it anyway (see the last tip on page 108). You can also use the base tag to set the base URL for constructing relative URLs. This can be particularly useful when a Perl CGI script (see page 253), located off in the cgi-bin directory, is generating the (X)HTML page, and you want to reference a bunch of images or links in the main part of your server. Use <base href="base.url" /> where base.url is the URL that all relative links should be constructed from. Put another way, the URL reflects the virtual location of the generated (X)HTML page. |