How to close a portlet window cleanly

Have a requirement for a standard web application to access an individual popup screen (form) in a different Portal application.

The "access" would be a simple URL link. The Popup is actually a new Portal definition with several different instances each representing a different type of individual popup form. They are all independent of one another.

So User is in the legacy (standard web application). They need to for example change their password. They click on the URL to the required portlet. It opens in new window. User then enters necessary data and submits. At this point, if successful, then the Portlet window should close.

I did this by having a confirmation "success view" jsp which uses body onload="javascript:close();" . This works but unfortunately when the User returns to the same popup, they are presented with the JSP that closed the window. In other words, it looks like the Portlet remembered the state.

Is there a better way to do this?

Thought about trying to hack the URL to look like a Render URL (rather than a simple URL to required portal page) with query params that would somehow reinitialise the portlet.

Thank you for any help or suggestions.

What does it mean to be well designed? A system that is well designed is easy to understand, easy to change, and easy to reuse. It presents no particular development difficulties, is simple, terse, and economical. It is a pleasure to work with.