I need a javascript solution to launch only one window, with a Java Applet in it, for a given URL. I found a solution posted here on Stack Overflow - here: JavaScript window.open only if the window does not already exist
But it doesn't seem to work .. I get Error: launchApplication.winrefs is undefined Line: 29
I can't seem to post the code in this little box and make it look right below, so the code (my working code, plus the solution from above) is here: http://pastie.org/833879
Where is the error?
As I understand it, the hash or array or whatever I use to store the called references to the windows opened this way will be lost if the calling window is closed.
Is there a way to make this work even if the calling window is closed and reopened? To basically ask the browser: "Do you have a window open with the following URL?" and if so, "What is the reference to that window?" (so I can raise it).
First Problem [Resolved]
I see that you're using
winRefs
in one spot, and laterwinrefs
. It may just be the case that you need to uppercase the R on the second. It appears that you've got the lowercase version in your code a few times, even after line 29. Be sure to update all of them before testing again.Second Problem
I just noticed that this line:
Will not return
true
if.winRefs
is absent. Of course we want it to return true if the property is not found so we have to wrapundefined
in quotes to get this working the way we want: