Results 1 to 6 of 6

Thread: Breaking out of Iframe

  1. #1
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    81
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Breaking out of Iframe

    I'm running a login script on my homepage from within an Iframe.
    I am pretty new to php and including some scripts on my homepage in Iframes, so i'm not breaking up the initial layout and I don't have to rewrite the entire site.
    When I hit submit-button on the login inside the frame, it shows the page I want to go to inside the Iframe (thru an include(); ). Is there anyway of breaking out of the Iframe and reloading a completely new page?

  2. #2
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    this isn't PHP question, but yes, there is- in javascript it's
    Code:
    parent.document.location

  3. #3
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    81
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I know its possible with javascript, but the code for the login is written completely in php. So I'm wondering if there is a similar command in php that i could include in the script so that I can get the same result.
    At this moment the script uses include() to go to the next page. All I want to know is, is there a command or script in php that would not refresh or reload the content inside the iframe the script is running in, but would load a totally different page.

  4. #4
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Not with php.

    you need javascript for this.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  5. #5
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    All your php does (from your description) is output HTML. All javascript is, is an (for a lack of better words) extension of HTML to create interactivity for the user in the webpage. All you should have to do is add the javascript posted above in the "included" page of your login script.

    Hope this helps.

  6. #6
    Join Date
    Oct 2006
    Posts
    183
    Thanks
    0
    Thanked 11 Times in 11 Posts

    Default

    make javascript so it is using parent.location.href, so like set the fields in document.write or something. One problem though would be how it logs in; For the most help I would recommend you put the code on here so that we can edit it and show you what to do.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •