iframe, prevent redirection out of the iframe?

Posted on 2005-04-07
Last Modified: 2010-08-05

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?
Question by:kgp43
    LVL 31

    Expert Comment

    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.

    Author Comment

    They are redirecting the frontpage to another website, witch reload the entire page (so no iframe anymore).
    Guess they are using php/header
    LVL 7

    Accepted Solution

    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=" = '';">

    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.

    Author Comment

    I deleted those accounts, so im not able to get the code :(

    Author Comment

    im closing this.
    dosent seems to be problem anymore.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
    This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now