In a web solution I want to reuse my child window but lose the reference to it when the main window refreshes.
How can I find an orphaned child window? (which is orphaned due to parent refresh)

/OF

Situation:

Parent window exists.

User presses button to open Child window.

User enters text in Child window.

User asks Parent window to refresh.

User presses button to open Child window.

Child window refreshes and user's text is gone.

In my case the Parent is a CMS and it is quite natural for it to reload when the user looks at a new article; this situation isn't new. What is new is that I have an editable child window.

So the real-world situation is like:

User browses a site (a CMS).

User opens a popup and is asked to enter some data.

User enters some data in the popup.

User decides to look at a new article (gets a new URL in parent).

The popup is now hidden so the user clicks top open the popup again.

The popup is refreshed (what I try to avoid) and focused.

The only workarounds I have found is to use iframe, frameset or open a third window and none of these solutions are possible in my situation.

Calling

wnd = window.open( "", "uniquename" );

doesn't work since it reloads the child.

Untried ideas are to check if the wnd handle is unique for the browser session and store it in a cookie or similar. Another untried idea is if the child can find out if it is orphaned and then, through a timer, try to find its parent.

Don't like the idea of timer though and the time gap where it is possible for the user to circumvent the hack. So I guess the transition POC->real-world-application will have to wait.
–
LosManosJul 7 '11 at 6:52