Hi all. Since this is a forum for any topics, figured I'd post an html/javascript question here. Here's the situation:
I've got a select menu from which users can choose a number of browser-based applications. All but one of these will open up in the same window. However, for this one which opens in a pop-up window, when a user selects it, I need to be able to check if an instance of the pop-up window is already present, and if it is, bring it into focus, if it is not, open one up.
Here's what seems to be kind of working:
var IsCMS = false;
function launchCMS() {
if (IsCMS == false) {
CMS = window.open("window stuff removed to save space");
IsCMS = true;
CMS.focus();
} else {
CMS.focus();
}
document.WMSLaunchApp.WMSAppList.selectedIndex = document.WMSLaunchApp.WMSAppList.options[0];
}
Now, as I said this is working, but it's not perfect.
If a user were to select the CMS option which opens up the new window, then IsCMS is set to true after the window is opened.
If the user were later to close the CMS window, and then again select the CMS option, but without having reloaded the page with the select list, the var IsCMS will still be set to true, and the script will try to bring the CMS window into focus, when it doesn't exist, thus throwing an error.
Can anyone think of a way around this?
I just went through the situation I described above, and this is the error message I received:
The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call did not execute.
I've been working with Javascript since '97 and I've NEVER seen an error of this variety.
Any ideas?
Thanks in advance,
Pablo