Cannot refresh parent window from popup when the page on parent window is changed.
I have a multi-frame parent window. A popup is launched from one of the frames in parent window. The focus is set on the popup fine if I only click on the links on the frame that launchs the popup. However, if I click on the links in other frames, the popup will lose focus and then the parent window is loaded with other pages. In this case, "top.opener.document" in popup will cause Javascript error. Here is the code that I use "top.opener.document" to refresh parent window.
<script>
function closepopup()
{
//this "if" does not tell me the parent is changed or not
if (top.opener && !top.opener.closed && top.opener.parent != null)
{
var parentWindow = top.opener.document; //Cause Javascript error
parentWindow.getElementById("MainForm").submit();
}
window.close();
}
</script>
...
Bookmarks