Re: PopUp Window from Codebehind

From: Greg Burns (greg_burns_at_DONT_SPAM_ME_hotmail.com)
Date: 09/09/04


Date: Thu, 9 Sep 2004 15:01:40 -0400

Kevin,

This has been bother me for quite awhile.

Why does my code for a pop-up window from my app not get blocked by IE SP2
pop-up blocker or the Google toolbar? (Yet some other pop-up blockers that
my users have installed does block it)

(No exceptions have been made in IE's Pop-up blocker settings either)

    Private Function openNewWindow(ByVal url As String, ByVal windowName As
String, ByVal features As String) As String

        ' url parameter must be enclosed in single quotes!!!

        Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder
        sb.Append("javascript:var " & windowName & " = window.open(" + url +
",'" + windowName + "','" & features + "');" & windowName & ".focus();")

        Return sb.ToString()
    End Function

The code is not really important here. I think I might be missing the big
picture; are pop-up allowed if they are user initiated. (i.e. a user click a
hyperlink that causes the pop-up)?

BTW, here is a great link I saw yesterday to encapsulate creating a pop-up
into a class:

http://www.dotnet2themax.com/ShowContent.aspx?ID=5f606582-4626-4c6f-a6e9-6f952f31491a

Greg

"Kevin Spencer" <kspencer@takempis.com> wrote in message
news:Oe65wZplEHA.324@TK2MSFTNGP11.phx.gbl...
> Forgive me. I spoke too quickly Upon reflection, I realized that
> JavaScript
> can't click a hyperlink. Oh well. I can't think of any other way to open a
> new browser window that won't be foiled by popup blockers. Best to try
> another route.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> I get paid good money to
> solve puzzles for a living
>
> "bruce barker" <nospam_brubar@safeco.com> wrote in message
> news:ed96JxolEHA.3544@TK2MSFTNGP15.phx.gbl...
>> while you can emit javascript to do this, any popup blocker will stop it.
>>
>> -- bruce (sqlwork.com)
>>
>>
>> "Rathtap" <amcniw@yahoo.com> wrote in message
>> news:b21a5958.0409090743.56e95c28@posting.google.com...
>> > I want to popup a window from my codebehind. The reason is that during
>> > the postback the code needs to do some validations and to build the
>> > arguments that are passed in the url. How can I achieve this
>> > functionality?
>> > The reason I do not want to use Response.Redirect is because when the
>> > user comes back to the first page, all the selections that were
>> > made(which are the arguments) disappear.
>>
>>
>
>



Relevant Pages

  • Re: Parse-ing Strings
    ... What is happening is that the user fills in a form in a pop-up window. ... Javascript on the client side makes the string, and passes it from a pop-up ... to a hidden input in the main window's form. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Blank Pop-up
    ... Noel and anyone else who thought about my problem. ... but reinstalling the scripting engine didn't help. ... >> It's more possible that your scripting engine is failing - with all pop-up ... >>> turning off the pop-up blocker. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: PopUp Window from Codebehind
    ... It's not a popup if the user clicked it, ... > Why does my code for a pop-up window from my app not get blocked by IE SP2 ... > (No exceptions have been made in IE's Pop-up blocker settings either) ... > Private Function openNewWindow(ByVal url As String, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: A pop-up window was blocked
    ... I turned off the pop-up blocker and even added our site under the allow ... pop-up but stil still giving me A pop-up window was blocked message on the ... "siljaline" wrote: ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: WinXP blocking wanted pop-ups
    ... > turned off the blocker in WinXP SP2. ... > pop-up blocker and turning off the blocker. ... pop-up controls isn't going to affect that. ...
    (microsoft.public.windowsxp.help_and_support)