1. Home
  2. Computing & Technology
  3. Web Design / HTML

HTML Frames Targets
Open Links in the Frame You Want Them to Open In

By , About.com Guide

The most common problem with frames is getting the links to open in the correct frame. This is called targeting. You give your anchor tags a "target" to open their links in. The target is usually the name of the frame.

The Four Standard Targets

There are four standard targets that don't require a named frame. These are targets that the user agents recognize:

  • _self
    This is the default target for any anchor tag. If you don't set a target or you use this target, the link will open in the same frame that the link is in.
  • _parent
    If you think of a frameset as being a top level frame that is the entire Web site, and any frames within it are children of that frame. If you then nest additional frames in another page, they will be children of that page. This target opens the link in the parent of the current frame.
  • _top
    This target will open the link at the very top of the frameset, removing all frames.
  • _blank
    This is the most commonly used target - it opens the link in an entirely new window, similar to a popup.

Naming Frames to Target Specific Frames

When you build a framed Web site, it's a good idea to give each frame a specific name. This helps you remember what the frames are for and allows you to send links to those specific frames.

I like to name my frames for what they are for. For example:

<frame src="navigate.html" name="navigation" />
<frame src="main.html" name="main" />

Once you've named your frames, use the target attribute on your anchor tags. Target the frame name where you want the links to open.

<a href="new.html" target="main">A new page</a>
Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. Frames
  7. Beginning Frames
  8. HTML Frames Targets - How to Target Links in HTML Frames>

©2009 About.com, a part of The New York Times Company.

All rights reserved.