Possible Duplicate:
jQuery .load method not firing on IE9
In IE7 and IE8 this code works, however in IE9, I can’t get the .load() function to work on a window handle.
var windowHandle = window.open(url, token, "height=150, width=400,alwaysRaised=yes", false);
$(windowHandle).load(function () {
alert('This is not getting executed in IE9');
});
EDIT: Working solution (kind of a hack)
window.setTimeout(function () {
if (windowHandle && windowHandle.document && windowHandle.document.readyState && windowHandle.document.readyState == "complete") {
windowHandle_Load();
} else {
$(windowHandle).load(windowHandle_Load);
}
}, 1000);
I suspect that when your URL is in your browser cache, it finishes loading before you install the
.load()handler. To try to detect that condition, you can try this:The property
document.readyStatehas been in most browsers for awhile, except it was added to Firefox in 3.6.Presumably, you would break the code you want to execute out into a common function that you could call in these two places rather than have two copies of it.