Pop up/ child window property "closed" is always true when the window is actually open in IE 11 and other lower versions

M

M Prajwal


// open new pop up window

this.childWindow = window.open("about:blank", "_blank");
this
.childWindow.document.write("<p>Loading..</p>");
this.childWindow.focus();


// submit form to cross origin domain from the pop up


this.childWindow.document.write("<form name='xform' method='POST' action='" + this.url + "' enctype='multipart/form-data'><input class='form-control' type='hidden' name='msg' id='xml'></input><input class='form-control' type='submit' id='formSubmit' style='display:none' ></input></form>"); this.childWindow.document.getElementById('xml').value = response.message;
this.childWindow.document.getElementById('formSubmit').click();


// window closed event


this.timer = setInterval(() => {


if (this.childWindow && this.childWindow.closed) {

// logic here when window closed


clearInterval(this.timer);
}
},
1000);


Continue reading...
 
Top Bottom