Forum Moderators: open
<body onUnload="parent.window.opener.location.reload(true);">
This code is in a page within a frameset in the pop-up window. Works perfectly on all but one Windows XP machine. On that machine IE6.0.2800... (very new browser) crashes when the pop-up is closed and Windows wants to send an error report. Mozilla works fine on the same machine. IE6 and older browsers work fine on every other machine tested.
Any ideas? Is there some setting in IE6 that I should look for on the machine that crashes, or is there a problem with the code, or is it possible that the browser is not backwards compatible with this code?
Any help is appreciated.
Thanks for the reply. I'm thinking along the same lines as you, that the script needs some tiny tweak to accommodate this latest version of IE. But I've tried all your suggested permutations of the code (and then some) with identical results (IE only crashes on the one machine and only at this one point). And no matter what reasonable sequence of methods and procedures I use (including all that you suggested), the code works on other machines with versions of IE6 that are only slightly older than the one that crashes?!?!?!?
I'm at a loss.
No luck with that. You know the funny thing is that IE generates a Windows error alert asking if I want to send an error report, and then IE closes. Usually, when a script doesn't work, it just doesn't do the deed and you get nothing other than maybe an "Error on page" in the status bar.?
If not for my belief that onunload is the final event, I might suggest something like this:
<script language="javascript" type="text/javascript">
function reloadMom() {
opener.location.reload(true);
// half-second delay then close child
setTimeout("self.close()",500);
}
</script>
<body onUnload="reloadMom()">
The problem with this, of course, is that the body unloads AS the window is closing, so there's no "self" to close by the end of the script.
If the user is clicking a BUTTON to close the window when done with whatever they are doing, you could use the button action to do the update before closing. If they use the little "x", though, you're in the same boat.
[edited by: StupidScript at 8:16 pm (utc) on Sep. 8, 2004]
I use this code in different types of pop-ups. Some of the pop-ups use framesets, others don't, and it doesn't seem to make any difference to the machine that crashes. Generally, the opener page is in a frameset as well. Also, with some of the pop-ups, other pages within the same frameset are capturing and sending data from/to a database, so that when the opener refreshes, the changes are displayed. The framed pop-up page with the opener.reload command is static, so its opener is truly in the window beneath the pop-up - I think. One may argue that the page containing the frameset is the true opener of the framed page but, again, this code works on all but one machine that we've tested. And referring to an opener of an opener (e.g. "parent.opener.opener.location.reload()") doesn't work.
I understand your point about lost reference using the onUnload method. Using onLoad, however, causes the focus to shift to the opener window prematurely. I could shift focus BACK to the pop-up, but that's too much action going on in front of the user (the pop-up disappears, the opener window refreshes, then the pop-up re-appears - all unprovoked from the user's standpoint). Is there another method that can make the opener refresh beneath without losing focus on the pop-up?
The Windows error message, however, does make it sound as if the problem is rooted deeper than the JS interpreter.