Popup window blocking in XP Service Pack 2

S

Simon Knox

Hi



I have a web app that has a legitimate use for pop up windows. My web app is
an insurance quoting app. I use the window.open method to display another
aspx page so that the user can check some information without losing where
they are up to in the application process.



I also use it later to display a pdf application form. I want this to be in
a separate window because a separate pdf application form is required for
each person and the application might be for more than one person. If I
display it in the main window then I would have to hope that the user would
know to click on back to go back and be able to display the pdf's for
another person.



I know I can have a hyperlink to the pdf and open it in a separate window
but it depends on user input so I use an "Apply" ImageButton, save the
details to the database and then generate the pdf. This wouldn't work with a
hyperlink.



This is an example of the code I am using in the click event of an
ImageButton



private void ibOpenWindow_Click(object sender,
System.Web.UI.ImageClickEventArgs e)

{

string javaScript = "<script>window.open('Info.aspx', 'Info', 'height=400,
width=400, resizable=no');</script>";

Page.RegisterStartupScript( "script", sJavaScript );

}



On MSDN I found this article:

http://msdn.microsoft.com/security/...x?pull=/library/en-us/dnwxp/html/xpsp2web.asp



It contains the following text:

<quote>

What does Internet Explorer consider a pop-up window?
Internet Explorer will attempt to block any window opened automatically from
script, with the exception of createPopup(). Some common functions that are
affected are window.open(), showModelessDialog(), showModalDialog(), and
showHelp(). (Note: Targeting the search pane automatically is also blocked
due to pop-up blocking restrictions.)

A pop-up window opened as a direct result of a user action (e.g., clicking a
page element) will not be blocked. Pop-up blocking does not apply by default

to the Intranet or Trusted Sites Zones.

</quote>

Does this mean that I can not use window.open at all? Even if I turn popup
blocking off in SP2 the code above still does not work.

Does anyone know a way around this problem? I can't use window.createPopup
because I can't display an aspx page or pdf using this method.

Thanks for you suggestions

Simon
 
L

Lucas Tam

Does this mean that I can not use window.open at all? Even if I turn
popup blocking off in SP2 the code above still does not work.

Add the site to your trusted list of pop-up sites. Window.open should work
fine (works fine on my end).

Do you have another pop-up blocker running?
 
S

Simon Knox

Hi Lucas

Thanks for your reply.

I was hoping to find a way to avoid having to tell customers to add the site
to there list of trusted sites as I think many customers might be concerned
about why they have to do this.

Simon
 
L

Lucas Tam

I was hoping to find a way to avoid having to tell customers to add
the site to there list of trusted sites as I think many customers
might be concerned about why they have to do this.

This is by design - as you know, pop-ups are abused by many sites... so
Microsoft treats all with suspicion. This is how all pop-up blockers work.

I guess you'll have to put a big message telling users to allow pop-ups, or
verify the pop-up has actually occured or else display an error message.
 
G

Guest

Did you ever find a work around this problem? I have the same issue. I need
an excel file to be opened up using window.open() but IE security setting
"automatic prompting for file download" has to be enabled in the users
machings for it to work. By default it is disabled, so I am also looking for
a way to do the same thing without asking the users to change any of their
settings. Did you find something like this?

Simon Knox said:
Hi Lucas

Thanks for your reply.

I was hoping to find a way to avoid having to tell customers to add the site
to there list of trusted sites as I think many customers might be concerned
about why they have to do this.

Simon
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top