“Target” is one of the attributes for the anchor tag. The target attribute specifies where to open the resource linked by an anchor element. Attributes of an anchor element that is <a>..</a> are explained below:

  1. _blank: if blank is used, the corresponding resource is opened in a new window or a new tab.
  2.  _parent: when using parent, the resource is opened in the parent frame.
  3. _self: self is used to tell the browser to open the resource in the same frame.
  4. _top: to make the browser open the new resource in the same window, top is used.

Framesets are the most common element in which targets are used. But frames are no more popular these days. They are rarely used in nowadays websites. Irrespective of this, there is one essential and easy use for target that is both quick and somewhat efficient. As explained above you can use the attributes of the anchor elements to specify where to open the new resource: in a new frame or a new window. For example, if you linked to another site, normally when the user clicks on the link they would leave your site when the browser loads the new site’s page. When using the _blank attribute, the browser remains on your site, but opens a new window to display the new resource. This is by far the most useful and easy way to use the target attributes. It allows you to link to external sites and when user clicks on the link, the browser loads the new website in the new window. That is instead of losing your user to a new website you can make them to stay on your website and also open new websites in new windows.

HTML Anchors and Targets

Usually anchor does not refer to an anchor element. An anchor element is commonly called as a link or a hyperlink. The colloquial anchor stands for the specific type of the anchor element, where the link refers to another location in the same web page. To better understand this, consider this example: suppose you have a long web page, a tutorial perhaps, with a table of contents at the top. Each term in the table of contents can be used to specify the appropriate location in the entire web page.

Frames: a little more information

If you are a frequent user of the internet it is hard to assume that you would have never heard of frames in the websites. Frames are rarely used these days. They are highly inefficient and unattractive: they make the websites cumbersome and hard to understand. Frames allow the web developer to divide the entire browser display into different regions. And these regions can accommodate different HTML web pages at the same time. You can consider it as an old version of multitasking. Targets are useful with the frames. You can name each frame in the frameset and in any link on any of the independent pages you could specify the target. The resource referenced by the URL address then would be loaded into the corresponding frame specified by the target.

Written by Sourabh Bhunje

Sourabh Bhunje, B.E. IT from Pune University. Currently Working at Techliebe. Professional Skills: Programming - Software & Mobile, Web & Graphic Design, Localization, Content Writing, Sub-Titling etc. http://techliebe.com/about-us

Leave a Comment