what is difference between _self and _parent.. expalin simply

Dani AI

Generated

Short answer: these are values for the HTML target attribute that tell the browser which browsing context (window, tab, iframe, or frame) should load the link or form result. "_self" means “open in the same context” (the default). "_parent" means “open in the immediate parent context” of the current one.

Behavior in common situations:

  • When inside an iframe, target="_self" opens the link inside that same iframe.
  • target="_parent" loads the link into the parent document that contains that iframe (one level up). If there is no parent (already at the top level), "_parent" behaves like "_self".
  • For nested iframes, "_parent" goes only one level up; use "_top" to break out to the topmost context. Named targets let a link open in a specific frame by name.

Example (inside an iframe document):

<a href="page2.html" target="_self">Open inside iframe</a>
<a href="page2.html" target="_parent">Open in containing page (parent)</a>
<a href="page2.html" target="_top">Open in topmost page</a>

Other practical notes: the target attribute works on <a>, <area>, <form>, and the <base> tag (which can set a default). Frames are largely obsolete; iframes are still common. For opening new windows/tabs use "_blank" and pair it with rel="noopener noreferrer" to avoid window.opener security issues. As pointed to the spec for the formal definitions, and as noted in jest, the keywords are simple once the browsing-context relationships are understood.

Recommended Answers

All 2 Replies

I am _self
dad _parent is Dead
mum _parent is in Australia

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.