Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1235 How do I close a popup window after submitting a form from it?

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>

Feedback on 'Q1235 How do I close a popup window after submitting a form from it?'

©2018 Martin Webb