...

View Full Version : Proper popup control commands



Jerome
12-23-2003, 01:26 PM
Hi,

Out of a main window I open a popup with the following command and name

window.open
paywin

Q.
What are the proper commands to:

1. Check if the popup is opened.
2. Check the url of the popup. (for matching)
3. Close the popup

REMARK!
All these commands need to work out of the main window, so not self.close(); in the htm-file of the popup etc.

Thanks,
Jerome

fredmv
12-23-2003, 01:32 PM
Assuming foo is a reference to the new window...
if(!foo.closed && typeof foo != 'undefined')
{
// Window is open and exists...
}
if(!foo.closed && typeof foo != 'undefined') alert(foo.location);
foo.close();

Jerome
12-23-2003, 04:36 PM
Thanks for replying

Do You mean foo is a reference like the name of the opened window, in this case: paywin? If so paywin.close(); should work! Instead however, IE 5.0 crashes.

Or do You mean document.getElementById('paywin').close();
IE 5.0 crashes again.....

if window.opener is the reference of the main window, what is the reference of the opened window??

Thanks.
Jerome

fredmv
12-24-2003, 01:50 AM
Originally posted by Jerome
if window.opener is the reference of the main window, what is the reference of the opened window??
It's the variable in which contains a reference to the new window. For example:
var foo = window.open('bar.html', '', '');

Jerome
12-24-2003, 05:02 PM
Thanks Fredmv,

Merry Christmas!

Jerome

fredmv
12-24-2003, 05:45 PM
You're welcome! The same to you. :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum