Javascript,calling child window function from opener doesn’t work

The window creation is not a blocking operation; the script continues to execute while that window is opening and loading the HTML & javascript and parsing it.

If you were to add a link on your original page like this:

<a href="#" onclick="addWindow.getMaskElements();">Test</a>

You’d see it works. (I tried it just to be sure.)

**EDIT **

Someone else posted a workaround by calling an onload in the target document, here’s another approach:

function AddEmail()
{

        if(addWindow == null) {
        addWindow = window.open("test2.html",null,"height=220px, width=400px, status=no, resizable=no");
        }

        if(!addWindow.myRemoteFunction) {
            setTimeout(AddEmail,1000);
        } else { addWindow.myRemoteFunction(); }
}

This keeps trying to call addWindow.myRemoteFunction every 1 second til it manages to sucessfully call it.

Leave a Comment