have a simple javascript that will reload the parent window. It works fine when when the parent window is open, but I cannot find a way to check if the parent window is closed in IE.
The code is:
if (window.opener && !window.opener.closed)
window.opener.location.reload();
I am getting 'Permission denied' on the window.opener.closed statement. I don't think it is a cross domain issue because the reload works fine when the parent exists. How can I check if the parent exists on IE I tried window.opener.location and window.opener.document.all
Thanks

window.opener.closed and 'Permission denied' on IE 6.0
Warren13
Thats just sort of the way IE works. Ive been through all available documentation on IE in MSDN numerous times as I develop HTAs regularly and I havent come across an explaination as to why IE behaves that way.
Some things Ive just learned to accept...
CodeSweatAndBeers
I'm having identical problems. The try/catch solution works great, and I'm grateful for the solution. The behavior still makes me feel queasy, though. Can anyone explain the root problem
In my case, I have an object with a property set to a "dependent" window that I opened. When I close that dependent window by selecting its close button, then doing "if (myobject.windowproperty && !myobject.windowproperty.closed)" from the parent window throws the permissions error. It acts kinda as if windowproperty were an invalid, but nonnull pointer.
Chaseman
I wouldnt be able to tell you whether or not you're really experiencing a permissions error as that would really depend on your specific situation...
But if it were me, the way I would go about telling a if a parent window is closed or not is by using a try/catch construct and trying to set properties on the parent window's objects. Keep in mind, this will only produce accurate results if you are on the same domain.
Example:
<HTML>
<HEAD>
<SCRIPT language="javascript">
function checkParent() {
try {
window.opener.document.title = window.opener.document.title;
return "Parent Window is Open!";
}
catch(e) {
return "Parent Window is Closed!";
}
}
</SCRIPT>
</HEAD>
<BODY>
<BUTTON onclick="alert(checkParent())">checkParent()</BUTTON>
</BODY>
</HTML>