View Full Version : Prevent Iframe from redirecting parent

09-09-2008, 03:24 PM
Hey all,

Now chances are this is a JS related question but to be on the same side I figured I would post it in a more generic section.

I've designed a web page that basically has a header, and then an iframe containing an external site (very similar in fashion to a Google Image search, though I display information in the header).

Unfortunately though the site initially loads fine into the iframe, and I login fine to the iframe when I open up a menu option in the external site that page loads in the parent frame instead of the iframe, thus eliminating the header.

Any suggestions on how to prevent an iframe page from redirecting the parent frame would be much appreciated.


PS: In case you're worried about this being phising or advertising related. don't worry - it's for a school voting drive and I'm trying to display the list of candidates at the top.

09-09-2008, 03:28 PM
I don't think there is anything you can do to stop this, because the code that would make the site open a link in the parent window is on their site. The same problem would occur if you used frames.

09-10-2008, 03:54 AM
There's got to be a way around it, though. Embed it in a flash client? insert a browser window in a browser window? Side step ways.

Any ideas?

09-10-2008, 09:00 AM

I posted this in another topic here yesterday, it doesn't 100% do what you are looking for, but there may be a way to edit it to encorperate the heading information you want.