Web Analytics Made Easy -
StatCounter How do I close a popup from another page - CodingForum


No announcement yet.

How do I close a popup from another page

  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I close a popup from another page

    I am opening a form in a popup-window from a page in a frameset and then I target the "actionpage" back down in the frameset.
    Now, here's my question: Is there any way for me to check if the popup is still open and, if so, how do I close it from the "actionpage" which is located within the frameset?

    Please advise...

  • #2
    Let me get it clear first.
    You open the popup from a page in the frameset. Then the popup page is submitted to the frame where the popup opener page is located causing the opener page to be replaced thus loosing the variable that holds the popup handle.

    If I understood it correctly, here's what you should do.
    Let's say this is code that opens the popup.

    var popup = window.open("popup.htm","mypopup","width=500,height=300");

    You should put this code in the action page that replaces the opener page:

    //get handle of the popup again
    var origpopup = window.open("", "mypopup");
    if (origpopup && !origpopup.closed) origpopup.close();
    vBulletin Mods That Rock!


    • #3
      Thanx, works like a charm...