admin管理员组

文章数量:1415063

Good day to all.

I have this setup:

One page with text/whatever, that also includes an iframe (the page in iframe is created by me so I have access to it, I can modify its content).

What I need to do is that when I access a link from the iframe to open it on the mother page (navigate).

Until now I kind of failed to do that so any help would be appreciated.

For any further info just ask.

Good day to all.

I have this setup:

One page with text/whatever, that also includes an iframe (the page in iframe is created by me so I have access to it, I can modify its content).

What I need to do is that when I access a link from the iframe to open it on the mother page (navigate).

Until now I kind of failed to do that so any help would be appreciated.

For any further info just ask.

Share Improve this question asked May 10, 2011 at 15:58 zozozozo 8,58219 gold badges83 silver badges140 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 19

In all of the links that you want to affect the parent window do something like this:

<a href="somthing.html" target="_parent">GO THERE!</a>

Or with javascript:

<a href="javascript:window.parent.location = 'somthing.html';" >GO SOMEWHERE!</a>

If all you need to do is change the parent window's location from inside the iframe, it is very simple:

 window.parent.location = 'newWindow.html';

Or if you are using a link, just use it's "target" attribute.

You should use the target attribute <a href="" target="...">

For all the possible values of target, you can go here.

本文标签: htmlJavascriptiframenavigateclose parent window from iframeStack Overflow