Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Proper popup control commands

    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

  • #2
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Assuming foo is a reference to the new window...
    1. Code:
      if(!foo.closed && typeof foo != 'undefined')
      {
      	// Window is open and exists...
      }
    2. Code:
      if(!foo.closed && typeof foo != 'undefined') alert(foo.location);
    3. Code:
      foo.close();
    Last edited by fredmv; 12-23-2003 at 02:16 PM.

  • #3
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:
    Code:
    var foo = window.open('bar.html', '', '');

  • #5
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Fredmv,

    Merry Christmas!

    Jerome

  • #6
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You're welcome! The same to you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •