Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Use window object across pages...

    Hi
    When I access a page (page1), this page opens a new page(page2), when this page is closed it opens a new page (page3) with 'onunload'. How do I get page3 to alter the location of page1.

    /SB

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can't. The only way you could access page1 is via page2, so if you close page2, you're stuck.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Before you close page2, you can pass the opener reference to page3 and so it might be possible to change window1 from page3. I say might because I haven't tested this, and don't know if the variable pertains after page2 has been closed. Try it out.

  • #4
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi both

    I've testet it and I knew that I could reach page 1 if I had page 2 open the trick is that Page3 only opens when page2 is closed....
    And the bad thing is it's a must... Is it not a posibility to make an object which is reachable to all pages open who knows the object name, whitout any reference sendt between pages?
    I hope or then I'll have to make one :)

  • #5
    New to the CF scene
    Join Date
    Jan 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi again

    I've reached a soloution...

    when page2 is opened it sets a var closed = 'true' and when my page is closed I alter the location of Page1 but if page2 just clicks a link onUnload will still execute but before var closed will be set to 'false' and page1 will not be altered:

    onUnload="isclosed()"
    ........
    var closed = true
    ........
    function isclosed(){
    if(closed)
    window.opener.location="newlocation.html"
    }
    ....
    <a href="page.html" onclick="closed=false">link</a>


    hope it helps others in the same problem...
    thanks for your help both of you!


  •  

    Posting Permissions

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