1. Computing & Technology

Discuss in my forum

How to Open a Link in a New Window: Using Frames

Part 2: Targeting to Open a New Window

By , About.com Guide

See More About:

One of the side benefits that came out of the frames HTML is the ability to open a link in a brand new page. Using the target attribute will open the link as a full-sized, fully-functional new window.

Normally, you use the target attribute (of the anchor (a) tag) to open links in a frame already on the Web page. The frames are named in the frameset, and the target then opens the link in the named frame.

But if you target a frame that doesn't exist, the browsers will open a brand new browser Window. For example, you can target a frame called "new_page". Because that frame name doesn't exist, the browser will open the link in a new window, and call that window "new_page".

    <a href="/library/weekly/aa030600a.htm" target="new_page">

Every link that is targeted to the "new_page" window will open in the same new window.

If you want every link you write to open in a different new window, you could give them all different names, or you could use the special target "_blank". If you put the tag<base target="_blank">in the head of your page, all links on that page will open in a new window.

Next Page > Using JavaScript > Page 1, 2, 3

Previous Features

©2012 About.com. All rights reserved.

A part of The New York Times Company.