|
Beginner Tip:
Hit The Right Target With Your Links
by Larisa Thomason,
Senior Web Analyst,
NetMechanic, Inc.
Hyperlinks to related Web sites add value to your site. Visitors enjoy the easy access to related information while trading links with other webmasters increases your link popularity score. But remember: when visitors click on those hyperlinks, they're leaving your Web site. Use the TARGET attribute inside your <A> tags to keep your site in view.
Direct Visitors With The TARGET Attribute
Visitors who click on the following code go to the Internet.com Web site - and away from yours. If they visit a lot of pages on that site or follow some of that site's external links, they may never find their way back to you.
Look at this code:
<a href="http://www.internet.com">Internet.com</a> Web site.
You can make sure that your site stays available simply by including the TARGET attribute inside the <A> tag like this:
Visit the
<a href="http://www.internet.com" target="_blank">Internet.com</a> Web site.
Target="_blank" opens a new browser window that displays the Internet.com site. Your site still resides in the original browser window. Since the original window remains open, your visitors can easily go back to your page without clicking their browser's Back button numerous times.
Open Links In A Single Browser Window
But what if you have dozens of external links on your page? If each link opens a new browser window, your visitors will quickly have their desktop cluttered with them. They'll either be confused or annoyed - probably both.
Avoid confusion by giving the targeted window a specific name: win2. Target each external link on the page to win2 and your visitors will only have to deal with two browser windows: one for your site and one for your external links.
The code is almost exactly the same as above:
Visit the
<a href="http://www.internet.com" target="win2">Internet.com</a> Web site.
Get current news at <a href="http://www.cnn.com" target="win2">CNN's</a> Web site.
But the effect is different. Click on one of the links here.
A new browser window will open and display that Web page. Then, without closing the new window, click on the other link. See how it replaces the first site in the same window?
Of course, we used the name "win2" as an example. You can call it anything you want as long as you're consistent on the page.
Explain Yourself First
Remember that some visitors get annoyed when a link on your site unexpectedly opens a new browser window. They feel like your Web site is taking control of their computer. It's good manners to warn your visitors what will happen.
- Image Links: Include it inside the ALT attribute:
<a href="http://www.netmechanic.com/" target="win2"><IMG
SRC="/images/HTMLCode.jpg" ALT="Get HTML Code help at NetMechanic
- opens a new browser window."></a>
|
- Text Links: Include a link title for your text links. This only works with IE 4.0 and up and Netscape 6.
HTML Code help at <a href="http://www.netmechanic.com/" target="win2"
title="Visit NetMechanic's Web site. Opens a new browser
window">NetMechanic</a>.
|
- Links Page: If you have a specific "Related Links" page on your site, just include a note at the top of the page that all links will open in a separate browser window.
|
As a side benefit, these techniques make your Web site more accessible to disabled visitors who rely on text-only or spoken word browsers.
Need more HTML code help? NetMechanic's HTML Toolbox will scan your code for errors and alert you to browser compatibility problems.
|