I’m sorry for posting a “semi-duplicate”, but I’ve stopped getting answers in another question because it seems answered.
Question related to: jQuery target different window/popup.
So, i have this function which when fired creates a new window/popup. The problem is that jQuery is supposed to be listening for when the new popup is closed and do an alert, but the alert is fire as soon as the popup is created.
the code:
function idealPopUp(url){
var windowName = "idealPopUpWindow";
var windowSize = 'height=820,width=704,toolbar=no,scrollbars=yes';
var idealPopUpWindow = window.open(url, windowName, windowSize);
$(idealPopUpWindow).unload( function () {
alert("BING");
});
event.preventDefault();
}
Bind the event after the page has loaded: