Detect Function or Pop-Up Blocking

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David McCulloch

    Detect Function or Pop-Up Blocking

    QUESTION-1:
    How can I detect if Norton Internet Security is blocking pop-ups?

    QUESTION-2a:
    How could I know if a particular JavaScript function has been declared?

    QUESTION-2b:
    How could I know if Window.Open has been redefined?

    BACKGROUND:
    NIS Pop-Up blocker inserts a JavaScript "SymWinOpen " function into a
    client's HTML and then sets window.open = SymWinOpen. If I could detect
    whether or not that "SymWinOpen " function name has been defined then I would
    know if Norton's Pop-Up blocker was active.

    Thanks for any help!

    Dave


  • Noozer

    #2
    Re: Detect Function or Pop-Up Blocking


    "David McCulloch" <|@|.|> wrote in message
    news:tqnec.6521 3$z%1.36723@twi ster.rdc-kc.rr.com...[color=blue]
    > QUESTION-1:
    > How can I detect if Norton Internet Security is blocking pop-ups?
    >
    > QUESTION-2a:
    > How could I know if a particular JavaScript function has been declared?
    >
    > QUESTION-2b:
    > How could I know if Window.Open has been redefined?
    >
    > BACKGROUND:
    > NIS Pop-Up blocker inserts a JavaScript "SymWinOpen " function into a
    > client's HTML and then sets window.open = SymWinOpen. If I could detect
    > whether or not that "SymWinOpen " function name has been defined then I[/color]
    would[color=blue]
    > know if Norton's Pop-Up blocker was active.[/color]

    But why would you care? There are dozens of other popup blockers out there
    as well.

    If a user doesn't want a pop-up, what can you do about it?


    Comment

    • David McCulloch

      #3
      Re: Detect Function or Pop-Up Blocking


      "Noozer" <dont.spam@me.h ere> wrote in message
      news:%Gnec.8034 1$Pk3.41272@pd7 tw1no...[color=blue]
      >
      > "David McCulloch" <|@|.|> wrote in message
      > news:tqnec.6521 3$z%1.36723@twi ster.rdc-kc.rr.com...[color=green]
      > > QUESTION-1:
      > > How can I detect if Norton Internet Security is blocking pop-ups?
      > >
      > > QUESTION-2a:
      > > How could I know if a particular JavaScript function has been declared?
      > >
      > > QUESTION-2b:
      > > How could I know if Window.Open has been redefined?
      > >
      > > BACKGROUND:
      > > NIS Pop-Up blocker inserts a JavaScript "SymWinOpen " function into a
      > > client's HTML and then sets window.open = SymWinOpen. If I could detect
      > > whether or not that "SymWinOpen " function name has been defined then I[/color]
      > would[color=green]
      > > know if Norton's Pop-Up blocker was active.[/color]
      >
      > But why would you care? There are dozens of other popup blockers out there
      > as well.
      >
      > If a user doesn't want a pop-up, what can you do about it?[/color]

      Thanks for your reply. I am writing a web application that uses pop-ups
      (not for advertising). If anyone wants to use my service then they must be
      able to accept pop-ups from my site. I simply want to alert them to that
      need (and explain how to do it) if I know that pop-ups are being blocked.
      Any ideas about any of my questions?


      Comment

      • David McCulloch

        #4
        Re: Detect Function or Pop-Up Blocking

        "Noozer" <dont.spam@me.h ere> wrote in message
        news:%Gnec.8034 1$Pk3.41272@pd7 tw1no...[color=blue]
        >
        > "David McCulloch" <|@|.|> wrote in message
        > news:tqnec.6521 3$z%1.36723@twi ster.rdc-kc.rr.com...[color=green]
        > > QUESTION-1:
        > > How can I detect if Norton Internet Security is blocking pop-ups?
        > >
        > > QUESTION-2a:
        > > How could I know if a particular JavaScript function has been declared?
        > >
        > > QUESTION-2b:
        > > How could I know if Window.Open has been redefined?
        > >
        > > BACKGROUND:
        > > NIS Pop-Up blocker inserts a JavaScript "SymWinOpen " function into a
        > > client's HTML and then sets window.open = SymWinOpen. If I could detect
        > > whether or not that "SymWinOpen " function name has been defined then I[/color]
        > would[color=green]
        > > know if Norton's Pop-Up blocker was active.[/color]
        >
        > But why would you care? There are dozens of other popup blockers out there
        > as well.
        >
        > If a user doesn't want a pop-up, what can you do about it?[/color]

        You are correct that there are dozens of pop-up blockers in use today.
        Sometime in 2004, Microsoft plans to release its own version with Windows XP
        SP2. I simply want to be able to detect the most common pop-up blocking
        tools. Currently, NIS seems to be #1.


        Comment

        • Noozer

          #5
          Re: Detect Function or Pop-Up Blocking


          "David McCulloch" <|@|.|> wrote in message
          news:cRnec.6522 7$z%1.44920@twi ster.rdc-kc.rr.com...[color=blue]
          > "Noozer" <dont.spam@me.h ere> wrote in message
          > news:%Gnec.8034 1$Pk3.41272@pd7 tw1no...[color=green]
          > >
          > > "David McCulloch" <|@|.|> wrote in message
          > > news:tqnec.6521 3$z%1.36723@twi ster.rdc-kc.rr.com...[color=darkred]
          > > > QUESTION-1:
          > > > How can I detect if Norton Internet Security is blocking pop-ups?
          > > >
          > > > QUESTION-2a:
          > > > How could I know if a particular JavaScript function has been[/color][/color][/color]
          declared?[color=blue][color=green][color=darkred]
          > > >
          > > > QUESTION-2b:
          > > > How could I know if Window.Open has been redefined?
          > > >
          > > > BACKGROUND:
          > > > NIS Pop-Up blocker inserts a JavaScript "SymWinOpen " function into a
          > > > client's HTML and then sets window.open = SymWinOpen. If I could[/color][/color][/color]
          detect[color=blue][color=green][color=darkred]
          > > > whether or not that "SymWinOpen " function name has been defined then I[/color]
          > > would[color=darkred]
          > > > know if Norton's Pop-Up blocker was active.[/color]
          > >
          > > But why would you care? There are dozens of other popup blockers out[/color][/color]
          there[color=blue][color=green]
          > > as well.
          > >
          > > If a user doesn't want a pop-up, what can you do about it?[/color]
          >
          > You are correct that there are dozens of pop-up blockers in use today.
          > Sometime in 2004, Microsoft plans to release its own version with Windows[/color]
          XP[color=blue]
          > SP2. I simply want to be able to detect the most common pop-up blocking
          > tools. Currently, NIS seems to be #1.[/color]

          You're probably better off just testing to see if your new window opened at
          all instead of trying to detect the different software packages. Just
          because NIS is installed doesn't mean it's set to block windows.

          I'm not sure how you'd go about checking to see if your window opened, but
          I'm sure that someone here could tell you - assuming that it's possible.


          Comment

          • David McCulloch

            #6
            Re: Detect Function or Pop-Up Blocking

            > You're probably better off just testing to see if your new window opened
            at[color=blue]
            > all instead of trying to detect the different software packages. Just
            > because NIS is installed doesn't mean it's set to block windows.[/color]

            No, no... NIS only inserts the "SymWinOpen " function when it intends to
            block pop-ups. If the "SymWinOpen " Javascript function has been defined in
            a client's HTML, that means the client's NIS is configured to block pop-ups
            and NIS inserted its SymWinOpen function into my HTML code after it reached
            the client. If Javascript could test the existence of the "SymWinOpen "
            function, it could know if NIS is configured to block pop-ups.
            [color=blue]
            > I'm not sure how you'd go about checking to see if your window opened, but
            > I'm sure that someone here could tell you - assuming that it's possible.[/color]

            I would like to be more proactive than that (i.e., I would like to tell my
            clients that there might be a problem before it happens), but if I can't
            then I can't. Detecting an open window should be simple and I never thought
            about doing that -- thanks for the idea! NIS overrides the open's return
            code, but I might be able to test the window's presence and/or attributes.
            You have given me something to research. Thanks again.

            Dave


            Comment

            • Richard Cornford

              #7
              Re: Detect Function or Pop-Up Blocking

              David McCulloch wrote:[color=blue]
              > QUESTION-1:
              > How can I detect if Norton Internet Security is blocking pop-ups?[/color]

              Unless you can add a version number (or range of version numbers) to
              your specification for Norton Internet Security then the task is
              impossible as it is not possible to tell how future versions will go
              about pop-up blocking, and so impossible to tell what would need to be
              detected.
              [color=blue]
              > QUESTION-2a:
              > How could I know if a particular JavaScript function has been
              > declared?[/color]

              If the function has a name - if(typeof functionName == "function") { /*
              function exists */ }, though it is not difficult to arrange that
              declared functions are anonymous or defined within a closure. And also
              possible to arrange that a unique function name is generated for each
              separate request.
              [color=blue]
              > QUESTION-2b:
              > How could I know if Window.Open has been redefined?[/color]

              There is no - Window.Open - function, - window.open - might be converted
              into a string and tested to see if it conforms to one of the many
              parterres of strings produced by native code functions on various
              browsers. Though that can be defeated by code such as:-

              (function(){
              var o = window.open;
              var f = function(a,b,c) {
              return new Object();
              };
              f.toString = function(){retu rn ''+o;};
              window.open = f;
              })();

              - in which the new - window.open - function would report exactly the
              same string as the original.

              You biggest aid in the specific task of detecting past and current
              Norton Internet Security versions is that Norton have never employed
              anyone with javascript skills to write the code that they are inserting.
              So, at present, it is cured and relatively easy to detect (and
              circumvent once detected) but that may change, and is most likely to
              change if they discover people targeting their code for detection.
              [color=blue]
              > BACKGROUND:
              > NIS Pop-Up blocker inserts a JavaScript "SymWinOpen " function into a
              > client's HTML and then sets window.open = SymWinOpen. If I could
              > detect whether or not that "SymWinOpen " function name has been
              > defined then I would know if Norton's Pop-Up blocker was active.[/color]

              The most viable strategy for detecting pop-up blockers (apart form
              rigorously testing the object returned from the - window.open - call) is
              to try to open a window that loads a page that will report back its
              successful opening. The problem is deciding how long to give it to open,
              A slow modem connection, when the server and intervening network is
              heavily loaded, might necessitate quite a long wait before it was safe
              to assume that the page was not going to load. And when a page doesn't
              show up in the allotted time span it is still not possible to tell
              whether it was because of the actions of a pop-up blocker or whether the
              user closed the window before it had time to load the page (Alt-F4 and
              the like).

              Given the multitude and diversity of pop-up blocking mechanisms, the
              best strategy for dealing with the problem is to design web sites and
              web applications so that they do not need to attempt to open new windows
              (especially as some browsers cannot open new windows anyway). The
              majority of the applications of new windows that I see could be done
              without going outside of the original window, and are apparently used
              because opening a new window is the "easy" approach. Of course it is
              only easy when the pop-up blocking issues are ignored, add any viable
              attempt to detect, circumvent or compensate for pop-up blocking and
              opening new windows suddenly doesn't look nearly as simple in comparison
              with the reliable alternatives.

              Richard.


              Comment

              • David McCulloch

                #8
                Re: Detect Function or Pop-Up Blocking

                > Unless you can add a version number (or range of version numbers) to[color=blue]
                > your specification for Norton Internet Security then the task is
                > impossible as it is not possible to tell how future versions will go
                > about pop-up blocking, and so impossible to tell what would need to be
                > detected.[/color]

                Understood. I simply want to be able to detect today's most common
                situations where a window cannot be opened. I realize that I will have to
                adapt to future changes.
                [color=blue]
                > If the function has a name - if(typeof functionName == "function") { /*
                > function exists */ }, though it is not difficult to arrange that
                > declared functions are anonymous or defined within a closure. And also
                > possible to arrange that a unique function name is generated for each
                > separate request.[/color]

                THANK YOU!!! That is the answer that will allow me to move forward. I
                forgot about "typeof" (excuse me while I kick myself). I tested it and it
                does what it needs to do. Thanks again! :-)
                [color=blue]
                > You biggest aid in the specific task of detecting past and current
                > Norton Internet Security versions is that Norton have never employed
                > anyone with javascript skills to write the code that they are inserting.
                > So, at present, it is cured and relatively easy to detect (and
                > circumvent once detected) but that may change, and is most likely to
                > change if they discover people targeting their code for detection.[/color]

                True. In my case, however, the client really wants my pop-up windows so I
                won't be the one whom Norton targets (I *will* probably be a victim of their
                fallout, though). My windows aren't workarounds and they aren't abnoxious
                advertisements. I have a real functional need that is best addressed by
                opening new windows.

                I have heard that Microsoft is planning to release their own version of
                Pop-Up Blocking in Windows XP SP2. Fortunately for me, they plan to allow
                clients to override their general settings by site. If Microsoft also
                allows a developer to check a client's settings then legitimate developers
                could benefit clients by giving them convenient instructions for changing
                their settings.

                Dave


                Comment

                • Brett Merkey

                  #9
                  Re: Detect Function or Pop-Up Blocking

                  Look up the JavaScript "try...catc h" statements. I use them to handle all
                  popup blockers equally.

                  Wrap your code to open a popup in the try statement. If it fails for any
                  reason, use the catch statement to redirect to an explanatory page or
                  show an alert (for instance) asking the user to disable popup blocking
                  for your domain.

                  Brett



                  Comment

                  • Lasse Reichstein Nielsen

                    #10
                    Re: Detect Function or Pop-Up Blocking

                    "Brett Merkey" <bmerkey@tampab ay.rr.com> writes:
                    [color=blue]
                    > Look up the JavaScript "try...catc h" statements. I use them to handle all
                    > popup blockers equally.[/color]

                    The problem is that not all browsers support try/catch. And the one
                    feature that could be used to recover from that would be
                    .... try/catch. So, it will just give a syntax error and fail in such a
                    browser. You need a fallback for try/catch then :)

                    /L
                    --
                    Lasse Reichstein Nielsen - lrn@hotpop.com
                    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                    'Faith without judgement merely degrades the spirit divine.'

                    Comment

                    • AM

                      #11
                      Re: Detect Function or Pop-Up Blocking

                      David

                      I don't know if you've already tried this, but if you haven't it might
                      be worth a shot:

                      function is_popup_blocke d() {
                      var mypopup=window. open("","win1", 'width=10,heigh t=10');
                      if (mypopup){
                      mypopup.close() ;
                      return false;
                      }
                      return true;
                      }

                      This is of course dependant on how the blocker works internally. I
                      know this works with Google's basic popup blocker and IE, haven't
                      tried with NIS, maybe you can.

                      HTH
                      andy.


                      "David McCulloch" <|@|.|> wrote in message news:<tqnec.652 13$z%1.36723@tw ister.rdc-kc.rr.com>...[color=blue]
                      > QUESTION-1:
                      > How can I detect if Norton Internet Security is blocking pop-ups?
                      >
                      > QUESTION-2a:
                      > How could I know if a particular JavaScript function has been declared?
                      >
                      > QUESTION-2b:
                      > How could I know if Window.Open has been redefined?
                      >
                      > BACKGROUND:
                      > NIS Pop-Up blocker inserts a JavaScript "SymWinOpen " function into a
                      > client's HTML and then sets window.open = SymWinOpen. If I could detect
                      > whether or not that "SymWinOpen " function name has been defined then I would
                      > know if Norton's Pop-Up blocker was active.
                      >
                      > Thanks for any help!
                      >
                      > Dave[/color]

                      Comment

                      • Brian Genisio

                        #12
                        Re: Detect Function or Pop-Up Blocking

                        David McCulloch wrote:
                        [color=blue]
                        > QUESTION-1:
                        > How can I detect if Norton Internet Security is blocking pop-ups?
                        >
                        > QUESTION-2a:
                        > How could I know if a particular JavaScript function has been declared?
                        >
                        > QUESTION-2b:
                        > How could I know if Window.Open has been redefined?
                        >
                        > BACKGROUND:
                        > NIS Pop-Up blocker inserts a JavaScript "SymWinOpen " function into a
                        > client's HTML and then sets window.open = SymWinOpen. If I could detect
                        > whether or not that "SymWinOpen " function name has been defined then I would
                        > know if Norton's Pop-Up blocker was active.
                        >
                        > Thanks for any help!
                        >
                        > Dave
                        >
                        >[/color]


                        The entire task of detecting popup blockers is too difficult to try.
                        Any method to do so might be thwarted by a new version of a popup blocker.

                        Also, If I use tabbed browsers, I can tell the browser to open popups in
                        a new tab, making it difficult to use the way you intend them to.

                        Instead, you might try to create an in-window popup. This method
                        requires you to create a a hidden DIV (I think SPAN works too) box that
                        can be dragged around (it will be a little tricky to get working, but I
                        think there are a lot of examples of dragable layers on the internet).
                        When you want the "popup", you make the "layer" visible. The user can
                        move it around the window, but not out of the screen. You can use an
                        IFRAME to display external content if you want.

                        All in all, I really like this method of popups. A popup blocker cannot
                        block it, since it is still part of the page. It is not as annoying as
                        popups, since it does not appear in a new window.

                        Good luck,
                        Brian

                        Comment

                        • Yann-Erwan Perio

                          #13
                          Re: Detect Function or Pop-Up Blocking

                          Brian Genisio wrote:
                          [color=blue]
                          > You can use an
                          > IFRAME to display external content if you want.[/color]

                          I'd tried that near one year ago and had it work in IE, Mozilla and
                          Opera, but the emulation of window resizing was quite bad in Mozilla and
                          Opera, the iframe would't behave as I expected...
                          [color=blue]
                          > All in all, I really like this method of popups.[/color]

                          Me too, it's more reliable and you can provide more additional features,
                          like minimizing, transparency...


                          Regards,
                          Yep.

                          Comment

                          • Brett Merkey

                            #14
                            Re: Detect Function or Pop-Up Blocking

                            > The problem is that not all browsers support try/catch.

                            Serious commercial implementations assume the range of browser
                            versions and configurations compatible with making a profit.
                            Assuming otherwise makes no sense. With that in mind, all browsers
                            support try...catch.

                            Brett


                            Comment

                            • Reply Via Newsgroup

                              #15
                              Re: Detect Function or Pop-Up Blocking


                              Detecting NIS will be difficult but if you want to detect if a popup
                              window 'popped' or not then one method might be to have a hidden text
                              field in the parent window and open a popup window that contains a
                              javascript that writes a value to the hidden text field in the parent
                              window... Then, in your parent window, check to see if the hidden text
                              field has a value or not - If it doesn't then you know the popup has
                              been disabled... and... if it does have a value, then you know the
                              javascript in the popup executed which means the popup opened...

                              However... this makes the assumption that javascript is enabled (which,
                              if you're createing an application then I would guess you are targetting
                              folk who should have javascript enabled)...

                              Its only a suggested solution to your problem...

                              laters
                              randelld

                              Comment

                              Working...