Can iframe child page change the parent page's URL? And How?

Discussion in 'PHP' started by youlichika, Sep 5, 2010.

  1. #1
    the parent page's URL is: http://lcoalhost
    Child page position in the folder htdoc/page, Child page name: 1.php, 2.php, 3.php ... ...
    By default, the parent page's IFRAME is the 1.php,
    1.php has some buttons, I can switch to 2.php, 3.php ... ...(2.php, 3.php are also in this iframe)
    Can iframe child page change the parent page's URL?
    Such as: when iframe child page is 1.php, the parent page's URL is http://lcoalhost or http://lcoalhost / index.php? Page = 1
    when iframe child page is 2.php, the parent page's URL is http://lcoalhost / index.php? Page = 2
    when iframe child page is 3.php, the parent page's URL is http://lcoalhost / index.php? Page = 3
    ... ...
     
    youlichika, Sep 5, 2010 IP
  2. mike30

    mike30 Well-Known Member

    Messages:
    887
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    140
    #2
    The problem with that is that the "header" part of the page is already sent by the time the iframe is loaded to make a redirection, so causing an error. I think it could be a way to do this but needs to be more specific of how it will be used to work around it.



    ~Mike
     
    mike30, Sep 5, 2010 IP
  3. Cyrus255

    Cyrus255 Well-Known Member

    Messages:
    796
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    150
    #3
    To answer your first question: Yes. I've seen it first hand.
    But as to how, I am clueless on the specifics, though could figure it out with a nice old google search.
    For that matter, I fail to see how the process is any different from when iframing a separate domain and it redirects the top page. (which I've also seen)
    Maybe you should start from there.
     
    Cyrus255, Sep 5, 2010 IP
  4. youlichika

    youlichika Greenhorn

    Messages:
    74
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    Yes, I also tried to search with google, but I can not get a code example.
    So I ask for a help
     
    youlichika, Sep 6, 2010 IP