Hi,
I'm trying to do this:
$(function() {
var parent = window.opener;
$(window).bind('unload', function() {
parent.setTimeout(function() {
parent.console.log('Fired!');
}, 200);
}
});
The example above works well in FF, Chrome etc. but not IE8. In the latter, the callback specified in setTimeout() never seems to be fired.
Rationale is that I would like to execute some code in the parent window (window.opener), when a popup window is closed. I would like the popup to be responsible for this, and not the other way around.
Just to show that the concept works:
$(function() {
var parent = window.opener;
$(window).bind('unload', function() {
parent.console.log('Fired!');
}
});
Calling console.log immediately in the callback bound to unload (as in the example above) seems to be working in all browsers (not targeting IE6 here), but as soon as I add setTimeout() to the mix it breaks.
Is it possible? Is it a scope issue?