I am returning an array to the parent from my popup. It all works fine but the popup doesn’t close. I even tried window.close
function btnClick()
{
var myVal = $("input#hdnName").val();
var myVal1 = $("input#hid").val();
var myarray = new Array(myVal, myVal1);
window.parent.closeDialog(myarray);
window.close();
}
By security reasons, browsers only accepts
window.close()if that window was opened by awindow.open()on the same context.In your case, I think the problem is that the
window.close()is called by theiframebut it isn’t in the same context that opened the popup.You can try:
iframeinside.iframeinside. In fact, there are many jQuery plugins that can do it.