Re: Popup window blocking in XP Service Pack 2

From: Matt Berther (mberther_at_hotmail.com)
Date: 10/21/04


Date: Wed, 20 Oct 2004 21:52:10 -0700

Hello Simon,

Modify your code to run in the mouseup handler, rather than on page startup...

http://www.mattberther.com/2004/08/000530.html

--
Matt Berther
http://www.mattberther.com
> 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/productinfo/xpsp2/default.aspx?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
> 

Loading