Links: HTML
Open a Link in a New Window

Review A hyperlink is a direct connection from the current location of the cursor to another location.

Most familiar to web site visitors is the hyperlink that takes them to another place on the web.  For example, when you use a search engine it presents you with a list of hyperlinks to a variety of web sites that might have the information you are looking for.

Such a link is called an absolute hyperlink. The absolute hyperlink goes out to a file external to the current web site.

Because the link goes out to a file external to the current web site, visitors must use the BACK button on the web browser to return to the original site.  If visitors spend much time browsing deeply into the second site or venture even farther out on the web to yet another site, they may not be able to return to your site.
You can solve this problem and ensure your visitors an easy return to your site by writing the hyperlink code in such a way as to open an entirely new browser window to accommodate the linked site. 

In that way when your visitors leave the second site by closing the second browser window, they will find themselves back at your site.

Recall the format for an absolute hyperlink:

<A HREF="[address]">[clickable text]</A>

To open the hyperlinked page in a new browser window, simply add the TARGET attribute and a value for the target window to the Anchor tag.

Ex: <A HREF="[address]"> TARGET="[name of new window]"[clickable text]</A>

where [name of new window] tells the browser where to open the  link to the new site.

If you want to send the hyperlink to an new blank window, use the attribute " _blank"

Example:  Visit my home page.

If you click on the hyperlink above, a new browser window containing my home page will open.  When you close that browser page, you will find yourself back at this page.

The HTML code for the sentence above is:
Visit my <A HREF="http://www.nvcc.edu/home/ataormina"  TARGET="_blank"> home page</A>.
If you have more than one hyperlink on a page and you want to open more than one new window, give each new window a distinctive name.

Example:

Visit my home page.  Then visit my course: English 123, Writing for the World Wide Web.

When you click on the first link, the one to my home page, a new browser window will open.  Resize that window, then come back to this page and click on the second link, the one to my course page. A third browser window will open with my course page.

The HTML for the above example is
Visit my <A HREF="http://www.nvcc.edu/home/ataormina" TARGET="home">home page</A>. Then visit my course: <A HREF=http://www.nvcc.edu/home/ataormina/wdc" TARGET="web">English 123: Writing for the World Wide Web</A>.
If you want every hyperlink on your page to open in the same new window, put the BASE tag and the TARGET attribute within the HEAD tags at the top of your web page. 
Ex: <HEAD><BASE TARGET="_blank"></HEAD>

Links: HTML
Overview
Create Absolute Links
Create Relative Links
Create Mailto Links
Create Internal Links
Open a Link in a New Window

 

Personal Home PageWeb Design CenterTutorial MenuTop of Page

Web Design Center
Last Revised: March 16, 2004
© Agatha Taormina