Child windows can not access window.opener when multiple child windows are open

Discussion in 'Javascript' started by ian.michel@gmail.com, Dec 14, 2004.

  1. Guest

    I have a parent window that pushes a new window object onto an Array
    with the following code :

    OpenChild()
    {

    //totalNumWindowsCreated is global

    totalNumWindowsCreated = totalNumWindowsCreated + 1;
    childWnds.push(window.open(link, "child" +
    totalNumWindowsCreated,"dependent"));

    ..
    ..
    ..
    }

    This pops up a new window with every call. In the child window I call
    a parent function onbeforeunload, appClose() :

    function appClose(){

    if (window.opener && !window.opener.closed){
    window.opener.CloseChild(getQueryString("application"));
    }
    }

    This is in my frameset tag of the child code :

    <frameset ... onbeforeUnload='appClose()'>

    The window.opener.CloseChild() function is called perfectly when I have
    one child window open, but as soon as I create another child window
    both of the open child windows don't ever call it. They do both go
    into the onbeforeunload appClose() function, but do not call the
    window.opener.CloseChild() function inside of this routine.

    Anyone have any ideas why when I have two child windows open I can't
    access the window.opener functions?

    I have tried taking each new window out of the array and used the
    following code in CloseChild() :

    CloseChild()
    {

    //win and totalNumWindowsCreated are both global

    totalNumWindowsCreated = totalNumWindowsCreated + 1;
    var win = window.open(link, "child" +
    totalNumWindowsCreated,"dependent");

    ..
    ..
    ..
    }

    All to no avail...

    Thanks for the help in advance,

    Ian Michel
     
    , Dec 14, 2004
    #1
    1. Advertising

  2. Ivo Guest

    <> wrote
    > Anyone have any ideas why when I have two child windows open I can't
    > access the window.opener functions?


    Sorry, no idea. what does alert(window.opener) tell you ?

    > I have tried taking each new window out of the array and used the
    > following code in CloseChild() :
    >
    > CloseChild()
    > {
    > //win and totalNumWindowsCreated are both global
    >
    > totalNumWindowsCreated = totalNumWindowsCreated + 1;
    > var win = window.open(link, "child" +
    > totalNumWindowsCreated,"dependent");


    Because of the "var" keyword the variable win looks awefully local to me.
    Not sure how it relates to the described problem tho :-(.

    --
    Ivo
     
    Ivo, Dec 14, 2004
    #2
    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. Andrew Bewley via DotNetMonster.com

    window to window communication (window.opener)

    Andrew Bewley via DotNetMonster.com, Feb 3, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,091
    Andrew Bewley via DotNetMonster.com
    Feb 3, 2005
  2. =?Utf-8?B?TXJGZXo=?=

    Child window property window.opener null after postback

    =?Utf-8?B?TXJGZXo=?=, Apr 28, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    5,708
    =?Utf-8?B?TXJGZXo=?=
    Apr 28, 2005
  3. MrFez
    Replies:
    1
    Views:
    230
    Yunus Emre ALPĂ–ZEN [MCP]
    Apr 28, 2005
  4. js
    Replies:
    0
    Views:
    187
  5. window.opener, form.opener?

    , Jul 14, 2006, in forum: Javascript
    Replies:
    5
    Views:
    302
Loading...

Share This Page