views:

414

answers:

1

This happens in IE6 when the user opens a popup window that opens a PDF inside. (this part works).

Then, the user opens another popup window, and at this point i get this error.

There is a good description and a possible solution here

my question is this:

Is there a better solution? Opening up a window and closing it right away seems like a silly solution to me.

+1  A: 

I solved the problem using a try catch block.

windowHandle = window.open('',name,attributes);
try {
    windowHandle.document.location.href = url;
} catch (exc) {
    windowHandle.close();
    windowHandle = window.open('',name,attributes);
    windowHandle.document.location.href = url + suffix;
}
windowHandle.focus();

Seems to work for me.

yoda
Interesting, next time this comes up ill try your solution
mkoryak