force external page into iframe?

Discussion in 'Javascript' started by jshanman, Apr 27, 2006.

  1. jshanman

    jshanman Guest

    If I try to put a site into an iframe that has "escape frame" code in
    its source (posted below), it will reload the requested page into the
    parent instead of the iframe. Is there a way to prevent this from
    happening?

    One could use onunload to stop the redirection, but I would like to
    find a way to load a page into an iframe, even if it has this type of
    code.

    I have considered server code loading the content and re-displaying it
    but I would like to find a pre javascript solution.

    //this is not my code
    if (self != top) {
    if (document.images) {
    top.location.replace(window.location.href);
    } else {
    top.location.href = window.location.href;
    }
    }

    BTW: This is not with malicious intent...

    - JS
     
    jshanman, Apr 27, 2006
    #1
    1. Advertising

  2. jshanman wrote:

    > If I try to put a site into an iframe that has "escape frame" code in
    > its source (posted below), it will reload the requested page into the
    > parent instead of the iframe. Is there a way to prevent this from
    > happening?


    No. Otherwise there wouldn't be a lot of point in the author having the
    frame escape code.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Apr 27, 2006
    #2
    1. Advertising

  3. jshanman

    Randy Webb Guest

    jshanman said the following on 4/27/2006 11:42 AM:
    > If I try to put a site into an iframe that has "escape frame" code in
    > its source (posted below), it will reload the requested page into the
    > parent instead of the iframe. Is there a way to prevent this from
    > happening?


    Yes, you stop trying to Frame other peoples pages in your own page and
    you don't have a problem anymore.

    > One could use onunload to stop the redirection, but I would like to
    > find a way to load a page into an iframe, even if it has this type of
    > code.


    You think you can use onunload? Try again.

    > I have considered server code loading the content and re-displaying it
    > but I would like to find a pre javascript solution.


    Go server code. Client side isn't going to happen.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Apr 28, 2006
    #3
  4. jshanman

    jshanman Guest

    Randy Webb wrote:
    > jshanman said the following on 4/27/2006 11:42 AM:
    > > If I try to put a site into an iframe that has "escape frame" code in
    > > its source (posted below), it will reload the requested page into the
    > > parent instead of the iframe. Is there a way to prevent this from
    > > happening?

    >
    > Yes, you stop trying to Frame other peoples pages in your own page and
    > you don't have a problem anymore.
    >
    > > One could use onunload to stop the redirection, but I would like to
    > > find a way to load a page into an iframe, even if it has this type of
    > > code.

    >
    > You think you can use onunload? Try again.
    >
    > > I have considered server code loading the content and re-displaying it
    > > but I would like to find a pre javascript solution.

    >
    > Go server code. Client side isn't going to happen.
    >
    > --
    > Randy
    > comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    > Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


    Thats what I thought.

    FYI: This actually isn't something that I would ever do for myself, a
    freelance project was posted with this as one of the requirements. I
    was fairly sure it was impossible (using only javascript/iFrames), but
    now I'm 100% sure! Thanks!

    - JS
    http://www.endeavorpub.com
     
    jshanman, Apr 28, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis Esteban Valencia
    Replies:
    0
    Views:
    466
    Luis Esteban Valencia
    Jan 20, 2005
  2. Daedalous
    Replies:
    3
    Views:
    828
    Daedalous
    Jan 16, 2004
  3. Mark Anderson
    Replies:
    4
    Views:
    217
    Mark Anderson
    Mar 2, 2005
  4. Paul
    Replies:
    3
    Views:
    163
  5. Replies:
    0
    Views:
    114
Loading...

Share This Page