multiple calls to window.open not succeeding in IE

A

Alexey

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?
 
S

Stephen Chalmers

Alexey said:
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?
 
A

Alexey

Stephen said:
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.
 
S

Stephen Chalmers

Alexey said:
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?
 
A

Alexey

Stephen said:
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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top