• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2423
  • Last Modified:

iframe, prevent redirection out of the iframe?


I use an iframe to validate some websites/url's in my database.
However when a user use a header/redirect to forward the visitor to another page/url, then it jump out of the iframe.
Is there a way to keep it inside the iframe?
  • 3
1 Solution
If the page is from a different server/domain you can not effect the javascript of the iframe. Although I can not see how they can make it break out of the iframe unless they are opening a popup.
kgp43Author Commented:
They are redirecting the frontpage to another website, witch reload the entire page (so no iframe anymore).
Guess they are using php/header
As far as I know, PHP raw headers only apply to the window they're being called on. So I guess those websites are doing something like this:

<body onLoad="window.top.document.location = 'www.theirsite-goodbyeyouriframe.com';">

Moreover, GwynforWeb is right about server/domains across Iframes (at least on Windows clients, I can't tell about Unix clients). But I think that rule should work either side of the frames, so if the secondary website has some JS code like the one I wrote above they should be restricted.

Which means we (or at least I) need some more info:

1) Are you working on a Windows client?

2) What's the code your targets are actually using? Try to hit the ESC key (stop loading) so as to be able to view their redirecting code.
kgp43Author Commented:
I deleted those accounts, so im not able to get the code :(
kgp43Author Commented:
im closing this.
dosent seems to be problem anymore.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now