# HTML - How do I make a link in an iframed page overtake the current window?

**URL:** <https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295>\
**Category:** Factual Questions\
**Created:** [November 24, 2008, 6:33pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295 "2008-11-24T18:33:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [November 24, 2008, 6:33pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/1 "2008-11-24T18:33:20Z")

</div>

At the moment I have links on our intranet do one of two things when clicked.

Open in the same iframe.

Open in a new window.  
But I think the ideal would be to open in the current window but not the current iframe. In other words take over the current window.

How do I do that?

---

<div class="post-metadata">

**Author:** ![Swallowed\_My\_Cellphone](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Swallowed\_My\_Cellphone](https://boards.straightdope.com/u/Swallowed_My_Cellphone)\
**Post date:** [November 24, 2008, 6:36pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/2 "2008-11-24T18:36:10Z")

</div>

It’s been awhile, but I think it works the same as regular frames. Try: \< a href=“your URL” **target="\_top"** \>.

Had enough time to edit!

---

<div class="post-metadata">

**Author:** ![Stealth\_Potato](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Stealth\_Potato](https://boards.straightdope.com/u/Stealth_Potato)\
**Post date:** [November 24, 2008, 6:38pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/3 "2008-11-24T18:38:05Z")

</div>

I’m not sure about the parent thing, but I believe setting the target to “\_top” also works:

\<a href=“[http://straightdope.com](http://straightdope.com)” target=“\_top”\>Clicky clicky!\</a\>

EDIT: Hmm, maybe not so much. It’s been a long, long time since I’ve done anything with frames. 😛

EDIT2: Woops, my mistake. It **does** work. 😃

---

<div class="post-metadata">

**Author:** ![Swallowed\_My\_Cellphone](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Swallowed\_My\_Cellphone](https://boards.straightdope.com/u/Swallowed_My_Cellphone)\
**Post date:** [November 24, 2008, 6:39pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/4 "2008-11-24T18:39:56Z")

</div>

Delete repeat. I had just enough time to edit the old post

---

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [November 24, 2008, 6:40pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/5 "2008-11-24T18:40:43Z")

</div>

> [@Swallowed\_My\_Cellphone](#):
>
> It’s been awhile, but I think it works the same as regular frames. Try: \< a href=“your URL” **target=“parent”** \>.
> 
> Maybe.

It works when I add a \_ to the beginning of parent…  
\< a href=“your URL” **target=“\_parent”** \>.

Thanks for the help. Pretty much answered straight away. GQ doesn’t disappoint. (Nor does **Swallowed My Cellphone** 🙂 )

---

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [November 24, 2008, 6:42pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/6 "2008-11-24T18:42:15Z")

</div>

> [@Swallowed\_My\_Cellphone](#):
>
> Delete repeat. I had just enough time to edit the old post

target=\_parent seems to work also 🙂 (see my last reply)

This is going to make life easier, less ending up with several windows open to get to the right page(s)

---

<div class="post-metadata">

**Author:** ![Swallowed\_My\_Cellphone](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Swallowed\_My\_Cellphone](https://boards.straightdope.com/u/Swallowed_My_Cellphone)\
**Post date:** [November 24, 2008, 6:45pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/7 "2008-11-24T18:45:37Z")

</div>

**Lobsang** , there is a slight difference between “\_top” and “\_parent”.

If you want your link to be the main page, make sure it’s “\_top”.

For example, I used to work on a page that had _three_ framesets: header, middle, and footer (vertically arrranged). If the “middle” frame had an iFrame and I used “\_parent” as the target of my link, then thew new link would be in the space of the “middle” frame (like a child taking the place of its parent frame). The other two frames, “header” and “footer” would still be there.

If I used “\_top” the frames would go away because the linked URL would be the whole kit and kebootle. Sorry about that. As I said, it’s been awhile. When I checked an old example of work I did awhile ago, it jogged my memory. That why I tried to rush and correct myself. If you don’t have any other framesets, it won’t really matter.

---

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [November 24, 2008, 6:49pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/8 "2008-11-24T18:49:35Z")

</div>

That makes sense. I’ll use \_top instead.

Currently the page in question only has two ‘children’ (two iframes) so it’s not an issue. But to be correct (as I like to be) I’ll use \_top instead.

Thanks again.

---

<div class="post-metadata">

**Author:** ![Swallowed\_My\_Cellphone](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Swallowed\_My\_Cellphone](https://boards.straightdope.com/u/Swallowed_My_Cellphone)\
**Post date:** [November 24, 2008, 6:50pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/9 "2008-11-24T18:50:48Z")

</div>

Awesome, glad I didn’t lead you astray and **Potato** had my back.

---

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [November 24, 2008, 6:59pm UTC](https://boards.straightdope.com/t/html-how-do-i-make-a-link-in-an-iframed-page-overtake-the-current-window/474295/10 "2008-11-24T18:59:19Z")

</div>

Oh, I didn’t see **Potato** ’s replies. Thanks also to **Stealth Potato**
