Window.opener.$() not working in IE9

The use of jQuery below does not work for IE9 but works beautifully for Firefox, Chrome & Safari. Before I rewrite it without jQuery, I was hoping to get some feedback on what I’ve done. Not certain about standards compliance, just know it works fine for all the browsers I’m testing except IE.

The user provides an action from a popup window. The action references the opener window, removes a few elements from a hidden element and then immediately repopulates those elements with updated values based on that action.



// does not appear work like this in IE9
window.opener.$('div#hiddenShiftAbbrList').empty();

for (var j = 0, jj = nShifts; j < jj; j++)
{
     var newDiv = document.createElement("div");
     newDiv.setAttribute('id', j);
     // response[][] array is reference for value that new text node will take 
     newDiv.appendChild(document.createTextNode(response[0][j]));
     // does not appear to work like this in IE9
     window.opener.$('div#hiddenShiftAbbrList').append(newDiv);
}

If anyone has had success with a similar approach for IE, I’d appreciate the help. Thanks.

When the child is in control of making changes to the parent, there seems to be security-based problems there.

So, there seems to better success when the child calls a function of the parent, and passes appropriate data to that function so that the parent is then in charge of making such changes.

Okay, I can buy that. Will explore that logic and post a response when I come up with something that works. Thanks, Paul.

Got it working for IE9! Will incorporate that IE security logic into my coding from now on. Thanks, Paul! Super satisfying. Here’re the changes I made to my code:


//---------------------------

// js file associated with child (popup) window action
window.opener.ryanLib.emptyHiddenShiftList();
window.opener.ryanLib.repopulateShiftList(nShifts,response);

//---------------------------

// js file associated with parent window; functions called on by popup window;
// little function library I created (non-object literal notation)
var ryanLib = {};

// 1) empty hidden shift list elements
ryanLib.emptyHiddenShiftList = function()
{
	$('div#hiddenShiftAbbrList').empty();
};

// 2) repopulate with new values
ryanLib.repopulateShiftList = function(nShifts, response)
{
	for (var j = 0, jj = nShifts; j < jj; j++)
	{
		var newDiv = document.createElement("div");
		newDiv.setAttribute('id', j);
		newDiv.appendChild(document.createTextNode(response[0][j]));
		$('div#hiddenShiftAbbrList').append(newDiv);
	}
};

//---------------------------

Works like a charm. Thanks again.