Date: August 23th, 2006
Microsoft's latest security update (issued on August 8th, 2006) seems to have triggered a new Javascript bug in MSIE 6.0, which triggers a "Permission Denied" error when accessing the properties of a newly opened window-object while the new window is in the process of closing itself.
(Note: This bug does not seem to affect older versions of MSIE.)
See the original blog entry for comments/discussion.
var myWindow = null;
var myInterval = null;
var intervalMs = 25;
var checkWindowStatus = function() {
if (!myWindow || myWindow.closed) {
alert("the popup has been closed!");
clearInterval(myInterval);
myWindow = null;
}
};
var openWindow = function() {
if (myWindow) { return; }
myWindow = window.open("about:blank", "popup", "width=200,height=200");
myInterval = setInterval(checkWindowStatus, intervalMs);
};
Note: As you increase the value of intervalMs, the probability of the bug getting triggered approaches zero.
myWindow in a
try ... catch, and make your own assumtions as to what
happened if the try-block fails.