WebDevelopersNotes logo

home-icon Home / HTML / HTML links – Target attribute of anchor tag

HTML links – Target attribute of anchor tag

HTML links - Target attribute of anchor tag

As described in previous session, the Target attribute of <A> is most often used when dealing with frames. It specifies the window in which the document should be loaded. The TARGET attribute can take one of the six values below: (note the underscore for the first four)

  • _blank: Indicates a new window.
  • _parent: Specifies the parent frame which contains the source link.
  • _self: The meaning is very much obvious. The new document is loaded in the same frame.
  • _top: This indicates a new document window. It is a good way to break out of frames and load the document in the same window.
  • frame-name: You can use this to specify in which frame the document should be loaded.
  • RESOURCE WINDOW: This loads the document in a new browser window. This is same as _blank.

The links and their code are presented below. Click on the link to see how the TARGET attribute behaves.

<A HREF="test.html" TARGET="RESOURCE WINDOW">
Loads test.html in a new browser window</A>

Loads test.html in a new browser window

<A HREF="test.html" TARGET="_blank">
Loads test.html in a new browser window</A>

Loads test.html in a new browser window

<A HREF="test2.html" TARGET="_self">
Loads test2.html in this window</A>

Loads test2.html in this window

Sponsored Links

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

Joke - Eat, Sleep and Code

Sponsored Links

Tips

How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]

Fact

In September 2008, T-Mobile's G1 became the first phone to run Android. [more...]

We use cookies to give you the best possible website experience. By using WebDevelopersNotes.com, you agree to our Privacy Policy