Doubt with target attribute in HTML

What are the different possible values of target attribute in the anchor tag? Explain the functions of each with example.

@deeptanudatta
<a href="https://www.xyzabc.com" target="_blank">visit Link</a>

here target attribute is used for where we want the link should be open weather in same tab or in new tab. If you want the link to be opened in a new tab then you have to write target="_blank".
if you want the link to be open in the same page then don’t use the target attribute in anchor tag.

It is already given in the tutorial. My doubt is what are the other possible values of target attribute ? And what are the functions of each ?

Hi,
The target attribute in the anchor tag specifies where to open the linked document page.We can open in new window tab,in same window tab. I think,you are familiar with _blank value of target attribute.

"Boltiot Platform"

So, basically target attribute has four values that are following:-

  1. _blank = it opens the linked document page in a new window tab.
  2. _self = it opens the linked document page in same window tab.(this is default value)
  3. _top = it opens the linked document in the full body of window tab.
  4. _parent = it opens the linked document page in the size of parent window.

Hope this will be helpful for u.:slightly_smiling_face::slightly_smiling_face:
Mayur Jain

1 Like

Hiii…@ JAINMAYUR1997, first of all, welcome to the Bolt Forum and thanks for your response. Now, my doubts are :-
(a) What is the meaning of full body in the value _top ?
(b) What is the meaning of parent window in the value _parent ?

The _top value of target attribute opens the document in full body of window means it opens with maximize size of window.

The _parent value of target attribute open the document in the window frameset that is the parent of the current frame.It will open the in the next level up of a frame if they were nested to inside one another.

Now you will see that in image, orange colour line is parent window . And there is another window on this page (in green colur).So, with _parent value of target it opens the page in parent window.
It means ,linked document will be open in parent frame or window of current window i.e nested to parent window.

Hope this will be helpful for u !
Thanks

Thank You boss for the wonderful explanations with screenshots !!!

1 Like

It’s okay sir. Nice to meet you.

Mayur jain

No need to call be Sir dear :smile: !!!

1 Like

Hiii… Please explain the “_parent” value properly. I tried with both “_top” and “_parent” value, but I get the same result i.e., the link is opened with full window size in both the cases.
Do you mean to say that the output of “_parent” value depends on the previous output ?


the above one is the syntax for target tag .
_blank -Opens the linked document in a new window or tab.
_self -Opens the linked document in the same frame as it was clicked (this is default)|
_parent -Opens the linked document in the parent frame|
|_top -|Opens the linked document in the full body of the window|
|framename- |Opens the linked document in a named frame|

the syntax wasnt printed so am posting it here.
< a target="_blank|_self|_parent|_top|framename">