Flasz
Flasz

Reputation: 185

Passing variable to window.open

I have just encountered an error - I cannot access passed object in the dialog window in Internet Explorer 11. It works in Firefox and Chrome. What did Microsoft changed? As far as I remember it worked in previous versions?

var obj = {
wnd: window.open("/" + project + "/magic/dialog-timepair.html", "cellValue", "width=450,height=150"),
};
obj.wnd.cell = {sTime: 'x', eTime: 'y'};

Upvotes: 0

Views: 284

Answers (1)

David
David

Reputation: 218828

I believe it's more standard for the child window to pull a value from the parent window, as opposed to the parent window pushing a value to the child window. You can use window.opener in the child window to reference the parent window. So in the parent you might have something like this:

window.open("/" + project + "/magic/dialog-timepair.html", "cellValue", "width=450,height=150");

// ...

function getCell() {
    return {sTime: 'x', eTime: 'y'};
}

Then in the child window's page, when you need these values, you'd call:

var cell = window.opener.getCell();

Upvotes: 1

Related Questions