Page -> Popup -> New Page (close popup, leave old page open)

Discussion in 'Javascript' started by julie.siebel@gmail.com, Jan 17, 2006.

  1. Guest

    I KNOW this can't be as hard as I am making it.

    I have a travel client with two related websites. On the homepage of
    the new site (Call it "Site A") I am building for them, there is a link
    to a popup window that includes the European regions both companies
    offer (Links to both site A and site B).

    If they click on a region that is a "Site A" region, the popup closes,
    and the homepage is changed to the region page for Site A, for the
    selected region.

    If they click on a region that is a "Site B" region, a new window opens
    with the Site B region page, but the popup doesn't close, I am assuming
    because the focus is now on the Site B page. That means if they go back
    to Site A and try to get that popup again, there's a good chance it
    will be hidden behind the Site A homepage. (Besides, it's just messy
    leaving windows open like that.)

    And example Site B link within the Site A popup would be:

    <a target="newwindow" href="http://www.siteb.com/reg.asp?RID=337"
    onclick="window.open("http://www.siteb.com/reg.asp?RID=337","_blank");window.close();">Salzburg</a>

    If this link is clicked on, the Site A homepage remains open, the Site
    B Region page opens in a new window, but the popup does not close.

    I've tried using window.opener.location as well, but get similar
    results. What stupid thing am I doing THIS time?

    Thanks,

    Julie
    , Jan 17, 2006
    #1
    1. Advertising

  2. Guest

    OK, I *did* figure out that if I put this in the Site B region page
    (regionlist is the name of the popup window) it will close. But then it
    slows down the region page loading on Site B, and kind of "blinks". Any
    better solutions out there?

    regionlist=window.open('','regionlist','');
    regionlist.close();

    Thanks,

    Julie
    , Jan 17, 2006
    #2
    1. Advertising

  3. Guest

    OK, SOLVED, thank God, for the person who is searching for this. Note
    that I think this will only work if you have access to the page that
    you are linking TO as well as the one that you are linking from.

    The onclick was the same, other than I gave it a particular name -
    don't know if this made a difference or not, but I included it in case
    it did:
    onclick="window.open('http://www.siteb.com/reg.asp?RID=337','sitebregion');
    window.close();"

    THen in the reg.asp file for siteb, I included the following Javascript
    (remember, the name of my popup is regionlist):

    if (window.opener=="regionlist" && !regionlist.closed)
    regionlist.close();

    Haven't tested this cross-browse yet, and I'm hoping to God it will
    work - lol (Big site, minor page :)

    Hope this helps someone else!

    Julie
    , Jan 18, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Henry
    Replies:
    24
    Views:
    993
    alex23
    May 30, 2008
  2. Iñaki Baz Castillo
    Replies:
    7
    Views:
    821
    Iñaki Baz Castillo
    Jan 12, 2010
  3. Jens Peter Hansen
    Replies:
    7
    Views:
    499
    Randy Webb
    Jun 19, 2004
  4. Navillus
    Replies:
    7
    Views:
    233
    Randy Webb
    May 23, 2006
  5. Iulian Ilea
    Replies:
    1
    Views:
    292
    pcx99
    Dec 21, 2006
Loading...

Share This Page