multiple calls to window.open not succeeding in IE

Discussion in 'Javascript' started by Alexey, Jun 2, 2006.

  1. Alexey

    Alexey Guest

    I have a situation where I need to respond to a link click by opening 2
    windows and navigating to a URL in the parent window. Here's the
    function I invoke:

    function handleOfferLink(selfURL, instructionURL, offerURL)
    {
    window.open(selfURL, '_self').focus();
    window.open(offerURL, '_blank').focus();
    window.open(instructionURL, '_blank',
    'width=435,height=390,top=0,left=0').focus();
    return 0;
    }

    This code is invoked as a direct result of the user clicking a link
    (href). On FireFox (FF) I get totally expected behavior: both windows
    open and the parent window navigates to selfURL, however on Internet
    Explorer (IE), something interesting happens: the first call to open a
    new window succeeds, while the second is blocked. If I swap those 2
    lines around, instructionURL opens, while offerURL does not. I've
    tried taking out the dimension specs and everything else you could
    think of it. It just looks like IE doesn't wanna allow more than 1
    popup at a time, even if it's in response to a user action. I can't
    seem to find a good guideline to IE's popup blocker. Any advice?
    Alexey, Jun 2, 2006
    #1
    1. Advertising

  2. Alexey wrote:
    > I have a situation where I need to respond to a link click by opening 2
    > windows and navigating to a URL in the parent window. Here's the
    > function I invoke:
    >
    > function handleOfferLink(selfURL, instructionURL, offerURL)
    > {
    > window.open(selfURL, '_self').focus();
    > window.open(offerURL, '_blank').focus();
    > window.open(instructionURL, '_blank',
    > 'width=435,height=390,top=0,left=0').focus();
    > return 0;
    > }
    >
    > This code is invoked as a direct result of the user clicking a link
    > (href). On FireFox (FF) I get totally expected behavior: both windows
    > open and the parent window navigates to selfURL, however on Internet
    > Explorer (IE), something interesting happens: the first call to open a
    > new window succeeds, while the second is blocked. If I swap those 2
    > lines around, instructionURL opens, while offerURL does not. I've
    > tried taking out the dimension specs and everything else you could
    > think of it. It just looks like IE doesn't wanna allow more than 1
    > popup at a time, even if it's in response to a user action. I can't
    > seem to find a good guideline to IE's popup blocker. Any advice?



    By calling: window.open(selfURL, '_self') first, I would suspect that
    the script is being dismissed before it can complete. Is it OK to call
    it last?
    Stephen Chalmers, Jun 2, 2006
    #2
    1. Advertising

  3. Alexey

    Alexey Guest

    Stephen Chalmers wrote:
    > By calling: window.open(selfURL, '_self') first, I would suspect that
    > the script is being dismissed before it can complete. Is it OK to call
    > it last?


    That's a valid point and I've considered it. I don't believe that is
    the cause of the problem for 2 reasons:

    1. I do see other lines executing after that line, so it's not as
    though JS execution on that page is halted as soon as I make a call
    window.open(selfURL, '_self').

    2. In one of my tests, I've commented that line out and saw no change
    in behavior.
    Alexey, Jun 5, 2006
    #3
  4. Alexey wrote:
    > Stephen Chalmers wrote:
    > > By calling: window.open(selfURL, '_self') first, I would suspect that
    > > the script is being dismissed before it can complete. Is it OK to call
    > > it last?

    >
    > That's a valid point and I've considered it. I don't believe that is
    > the cause of the problem for 2 reasons:
    >
    > 1. I do see other lines executing after that line, so it's not as
    > though JS execution on that page is halted as soon as I make a call
    > window.open(selfURL, '_self').
    >
    > 2. In one of my tests, I've commented that line out and saw no change
    > in behavior.


    Have you eliminated the popup blocker by disabling it?
    Stephen Chalmers, Jun 6, 2006
    #4
  5. Alexey

    Alexey Guest

    Stephen Chalmers wrote:
    > Have you eliminated the popup blocker by disabling it?


    I'm sorry, I don't quite understand. If I disable the popup blocker in
    the browser, the popups work fine. I'm trying to get this to work for
    people who've not taken that step. Does that answer the question?
    Alexey, Jun 6, 2006
    #5
    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. Honne Gowda A
    Replies:
    2
    Views:
    858
    Karl Heinz Buchegger
    Oct 31, 2003
  2. andy6
    Replies:
    2
    Views:
    748
    andy6 via DotNetMonster.com
    Jun 9, 2006
  3. Richard Tobin
    Replies:
    24
    Views:
    768
  4. PC HUA
    Replies:
    2
    Views:
    391
    PC HUA
    May 19, 2004
  5. Replies:
    5
    Views:
    184
    Skye Shaw!@#$
    May 20, 2007
Loading...

Share This Page