I have the following code in Internet Explorer 8:
if (window.opener != null && window.opener.foo != null) window.opener.foo = bar;
Sometimes, window.opener is set. But if users open a popup and then navigate away, the attempt to set a property on it should be avoided.
In Firefox and Chrome, this works, because window.opener becomes null once the user exits or refreshes that window. In IE, however, window.opener is not null, and window.opener.foo gives "Permission Denied" instead of null. Because of this, window.opener.foo != null evaluates to true.
How do I get around this problem, what value matches "Permission Denied" in Internet Explorer?