javagoddess
asked on
One disobedient child window won't close when using FireFox
I am trying to solve an orphaned child window problem that is happening in Firefox. I dont know javascript very well, and I didnt write this, but the person who did is very knowledgeable. Neither of us can figure out whats wrong here.
There is an initial window, window1. A webpage is presented in window1 after signon to the webapp. From window1, a link is clicked which opens a new child window, window2, with javascript:openWindowNoBar (&). On window2, there are two buttons, ContactUs and Help. Each of these opens a child window, ContactUs=window3, and Help=window4. For ContactUs there is a call to javascript openContact; for Help there is a call to javascript openHelp. The signOff link on window1 calls the closeAll javascript function.
The desired behavior is, if the user goes back to window1 and clicks sign off, all child windows should close, and window1 should revert to signon page. All this happens, except for window3, which remains open when using Firefox. Everything works correctly using IE.
I inspected the cookie theChildWindow each step of the way, and the expected values were there. When signoff occurred, the cookie remained, and its value was empty. Even though the contact window remained, its cookie value was gone. Any suggestions?
Here are the functions that are called in the jsp.
function openContact(url)
{
Set_Cookie("theChildWindow ", "Contact", "/");
var contactWin = "";
contactWin = window.open(url,'Contact', 'menubar=n o,status=y es,toolbar =no,scroll bars=yes,r esizable=y es,width=6 20,height= 450');
contactWin.focus();
return false;
}
function openHelp(url)
{
var helpWin = "";
helpWin = window.open(url,'Help','me nubar=no,s tatus=yes, toolbar=no ,scrollbar s=yes,resi zable=yes, width=620, height=450 ');
helpWin.focus();
Set_Cookie("theChildWindow ", "Help", "/");
return false;
}
function Get_Cookie(name)
{
var start = document.cookie.indexOf(na me+"=");
var len = start+name.length+1;
if ((!start) && (name != document.cookie.substring( 0,name.len gth))) return null;
if (start == -1) return null;
var end = document.cookie.indexOf("; ",len);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.s ubstring(l en,end));
}
function Set_Cookie(name,value,path )
{
var domain = "ourCompany.com";
var cookieValue = Get_Cookie(name);
if (cookieValue != null) {
if (cookieValue.indexOf(value ) == -1) {
cookieValue += "," + value;
}
else {
return true;
}
}
else {
cookieValue = value;
}
document.cookie = name + "=" +escape(cookieValue) + ( (path) ? ";path=" + path : "") + ( (domain) ? ";domain=" + domain : "");
}
function closeAll(url)
{
var appIds = Get_Cookie("theChildWindow ");
if ((appIds == '') || (appIds == null)) {
thisWin = window.open("", 'statusSessionWin', 'toolbar=no,status=no,menu bar=no,res izable=yes ,width=1,h eight=1,to p=2000,lef t=2000,z-l ock=yes');
thisWin.close();
return true;
}
else {
var allApps = new Array();
allApps = appIds.split(',');
for (counter=0; counter < allApps.length; counter++)
{
if (allApps[counter] == '') { continue; }
thisWin = window.open("", allApps[counter], 'toolbar=no,status=no,menu bar=no,res izable=yes ,width=1,h eight=1,to p=2000,lef t=2000,z-l ock=yes');
thisWin.close();
}
}
Kill_Cookie("theChildWindo w", '', "/");
var appIds = Get_Cookie("theChildWindow ");
thisWin = window.open("", 'statusSessionWin', 'toolbar=no,status=no,menu bar=no,res izable=yes ,width=1,h eight=1,to p=2000,lef t=2000,z-l ock=yes');
thisWin.close();
}
function Kill_Cookie(name,value,pat h)
{
var domain = "ourCompany.com";
var killCookie = Get_Cookie(name);
killCookie = value;
document.cookie = name + "=" +escape(killCookie) + ( (path) ? ";path=" + path : "") + ( (domain) ? ";domain=" + domain : "");
return true;
}
Any help to solve this question will be greatly appreciated. :)
There is an initial window, window1. A webpage is presented in window1 after signon to the webapp. From window1, a link is clicked which opens a new child window, window2, with javascript:openWindowNoBar
The desired behavior is, if the user goes back to window1 and clicks sign off, all child windows should close, and window1 should revert to signon page. All this happens, except for window3, which remains open when using Firefox. Everything works correctly using IE.
I inspected the cookie theChildWindow each step of the way, and the expected values were there. When signoff occurred, the cookie remained, and its value was empty. Even though the contact window remained, its cookie value was gone. Any suggestions?
Here are the functions that are called in the jsp.
function openContact(url)
{
Set_Cookie("theChildWindow
var contactWin = "";
contactWin = window.open(url,'Contact',
contactWin.focus();
return false;
}
function openHelp(url)
{
var helpWin = "";
helpWin = window.open(url,'Help','me
helpWin.focus();
Set_Cookie("theChildWindow
return false;
}
function Get_Cookie(name)
{
var start = document.cookie.indexOf(na
var len = start+name.length+1;
if ((!start) && (name != document.cookie.substring(
if (start == -1) return null;
var end = document.cookie.indexOf(";
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.s
}
function Set_Cookie(name,value,path
{
var domain = "ourCompany.com";
var cookieValue = Get_Cookie(name);
if (cookieValue != null) {
if (cookieValue.indexOf(value
cookieValue += "," + value;
}
else {
return true;
}
}
else {
cookieValue = value;
}
document.cookie = name + "=" +escape(cookieValue) + ( (path) ? ";path=" + path : "") + ( (domain) ? ";domain=" + domain : "");
}
function closeAll(url)
{
var appIds = Get_Cookie("theChildWindow
if ((appIds == '') || (appIds == null)) {
thisWin = window.open("", 'statusSessionWin', 'toolbar=no,status=no,menu
thisWin.close();
return true;
}
else {
var allApps = new Array();
allApps = appIds.split(',');
for (counter=0; counter < allApps.length; counter++)
{
if (allApps[counter] == '') { continue; }
thisWin = window.open("", allApps[counter], 'toolbar=no,status=no,menu
thisWin.close();
}
}
Kill_Cookie("theChildWindo
var appIds = Get_Cookie("theChildWindow
thisWin = window.open("", 'statusSessionWin', 'toolbar=no,status=no,menu
thisWin.close();
}
function Kill_Cookie(name,value,pat
{
var domain = "ourCompany.com";
var killCookie = Get_Cookie(name);
killCookie = value;
document.cookie = name + "=" +escape(killCookie) + ( (path) ? ";path=" + path : "") + ( (domain) ? ";domain=" + domain : "");
return true;
}
Any help to solve this question will be greatly appreciated. :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forced accept.
Computer101
Community Support Moderator
Computer101
Community Support Moderator
You might also want to delete the duplicate question here,
https://www.experts-exchange.com/questions/22916063/One-disobedient-child-window-won't-close-when-using-FireFox.html before anyone answers so that you can keep your points and all the answers in one place.