You are here: irt.org | FAQ | JavaScript | Window | Q1235 [ previous next ]
Tuomas Salo writes:
The problem is how to close the popup window on the right moment.
My solution is:
- When submitting a form in a popup window, target the form into the popup window, not the main window.
- The script that the data was sent to will print a simple page to the popup window, something like this:
To just refresh the main window:
<html> <body onLoad="opener.location.href=opener.location.href; window.close();"> </body> </html>
Or maybe go to a different page:
<html> <body onLoad="opener.location.href='another.html'; window.close();"> </body> </html>