How To Identify If The Child Window Has Been Closed In Javascript?
i have this page which opens up a popup. i want to refresh the parent after popup has been closed.. i used the function i found in stackoverflow var win = window.open('popup.html
Solution 1:
You wrote the unload event in the wrong place. You added an unload event to the main page instead of to the popup...
var win = window.open("popup.html"); // O.K.
All of this should be in the popup.html page...
function doStuffOnUnload() {
alert("Unloaded!");
}
if (typeof win.attachEvent != "undefined") {
win.attachEvent("onunload", doStuffOnUnload);
} elseif (typeof win.addEventListener != "undefined") {
win.addEventListener("unload", doStuffOnUnload, false);
}
You can use the unload
jquery function:
$(window).unload(doStuffOnUnload);
unload
docs
Post a Comment for "How To Identify If The Child Window Has Been Closed In Javascript?"