Data string from parent window to popup not passed

Strange problem, should work but it does not.

Description:
Inside of a page, there is a iFrame, which houses WYSIWYG editor.
I’m trying to pass data (passedString: html, inline css, text …) to a popup.

Here’s the relevant part of a code:


var winRef = ""; //global var

function foo() {

//open popup window
winRef = window.open("popup.php", "blank", "toolbar=no,width=800,height=550");

//passed string to a popup
var previewData = "<div style=\\"padding:5px;\\">" + document.getElementById(passedString).value + "</div>";

// inserting string to div in popup, which is a simple page
// receiving div looks: <div id="idx"></div>
winRef.document.getElementById("idx").innerHTML = previewData;

}


What I’m receiving is:

winRef.document.getElementById(“idx”) is null

When I pass same string to same div with id=“idx” located on a page, where iFrame is located, it receives it without problems.
Problem appears, when I try to pass string to popup.

Any thoughts why?

window.open works asynchronously, so the page isn’t loaded when you reference it.