Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html what target="_parent" and "_top" does in anchor tag?

What target="_parent | _top" does in anchor tag?

<a href="somepage.html" target="_parent">link</a>

I didn't find any example for it. It would be great if someone could give real example of this attribute. I've checked various resources including stackoverflow

Are these attribute values deprecated, if not how could we use them now? I'm confused because articles regarding these attribute value only say what it does. but don't give example.

like image 563
Ashish Avatar asked May 10 '16 07:05

Ashish


People also ask

What does target _TOP do HTML?

A target=\"_top\" attribute specifies that the the linked page or form response will be opened in the topmost frame. The topmost frame is the full browser tab and window.

What does target _parent mean?

A target="_parent" attribute value specifies that the target page will be opened in a parent frame. The target page can be a linked page or a response to a form submission.

What is the difference between _parent and _TOP?

_parent: It opens the linked document in the parent frameset. _top: It opens the linked document in the full body of the window.

What is _parent in HTML?

_parent. Opens the linked document in the parent frame.


1 Answers

target="_self" This opens an anchor in the same frame. What is confusing is that because we generally don't write in frames anymore (and the frame and frameset tags are obsolete in HTML5) people assume this a same window function. Instead if this anchor was nested in frames it would open in a sandbox mode of sorts, meaning only in that frame.

target="_parent" Will open the in the next level up of a frame if they were nested to inside one another

target="_top" This breaks outside of all the frames it is nested in and opens the link as top document in the browser window.

like image 86
Obadah Hammoud Avatar answered Oct 01 '22 09:10

Obadah Hammoud