I do something like this quite regularly.


I open a window on one page, then after a few screen refreshes I close the
window.


The attached is the code that I use.  It should work.  Generally what it
does is opens the window with a specific name on one screen.
Then after a few screen refreshes the new page runs the code to open a
window with the same name.  It doesn't actually open the new window, it just
gets control of the original popup window and then it closes it.


There is other code in these js clips, but you should be able to get rid of
them.


<!--- CODE THAT GOES IN THE PAGE THAT OPENS THE CHILD WINDOW --->
<script language="_javascript_">
<!--
function popup() {
var winnew;
<CFOUTPUT>
var myWtPg = '#InclDir#bau_wait.cfm?type=PROC';
</CFOUTPUT>
var myWtPgSet =
'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,width=400,height=200';
var myRetTxt = 'Changes made to the database cannot be rolled back. \n';
myRetTxt = myRetTxt + 'Are you sure you want to run the procedure?';
var ret =  confirm(myRetTxt);
if (!ret)
return false;


winnew = window.open(myWtPg, "Wait", myWtPgSet);
winnew.focus();
}
//-->
</script>


<!--- CODE THAT GOES IN THE PAGE THAT CLOSES THE CHILD WINDOW --->
<script language="_javascript_">
<!--var winnew;
var myOpts;
myOpts =
"toolbar=0,location=0,status=0,menubar=0,scrollbars=0,width=400,height=200";
winnew = window.open(" ", "Wait", myOpts);
winnew.close();
//-->
</Script>


Steve

-----Original Message-----
From: Pascal Peters [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 3:51 AM
To: CF-Talk
Subject: RE: _javascript_ window.close() twist

The problem is that when you refresh the parent window, the parent-child
relationship is destroyed. You can create a frame set with only one frame
and open the window from the frameset. This way the relationship still
exists after refreshing the frame. When you log out, trigger another
function in the frame set to close the child.
If frames are not an option, I don't see an easy solution. You could make
your child refresh every x seconds and if the user logged out, close the
window, but this is not an elegant solution and might give you problems if
the menu is using dhtml (can't keep status on refresh)

HTH
Pascal

-----Oorspronkelijk bericht-----
Van: Brrrian [mailto:[EMAIL PROTECTED]
Verzonden: ma 10/11/2003 3:13
Aan: CF-Talk
CC:
Onderwerp: _javascript_ window.close() twist

------------
The Issue
------------
When the user wants to LogOut I need to Close the Child Window.  I can't
get anything to work.

  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to