PDA

View Full Version : Close window, refresh page, why is this so hard



JasonTC
04-20-2006, 05:02 PM
I have a php script with a list of links. When the user clicks on a link, a window pops up with a different php script where the user can some fields. When that form is submitted, the window closes.

I need the original page to reload when the popup window closes. I think there would be two ways of doing this:

- Have the popup window's php script call the original window's php script
- Have the original script listen for an onunload() event of the popup window

For some reason, I'm finding it incredibly difficult to even find an example of how to handle a window's events. I can't believe how poor JavaScript documentation is online. If someone could, at the very least, point me to a serious reference site, not a site with a grab bag of novelty scripts, I would appreciate it.

Thanks,
Jason

Twey
04-20-2006, 05:19 PM
- Have the popup window's php script call the original window's php scriptThat would require client-side interaction by PHP, which is of course impossible.
- Have the original script listen for an onunload() event of the popup windowLike so:
<body onunload="window.opener.location.href = window.opener.location.href;">
For some reason, I'm finding it incredibly difficult to even find an example of how to handle a window's events.Well, there are plenty out there.
I can't believe how poor JavaScript documentation is online.The definitive reference is, of course, ECMA RFC 262 (http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf).