Popup detection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Agony.COM

    Popup detection

    Hi there all,

    Is there a way, using Javascript, that you can detect if a popup window has
    opened successfully?
    I'm tring to work out if someone is running popup blocking software or not.

    Cheers,

    @ndyB


  • Michael Winter

    #2
    Re: Popup detection

    On Thu, 6 May 2004 10:10:11 +0100, Agony.COM <info@agony.com > wrote:
    [color=blue]
    > Is there a way, using Javascript, that you can detect if a popup window
    > has opened successfully?[/color]

    Check the Google groups archive for partial solutions. This topic has been
    discussed more than once, but I believe the basic answer is, no. At least
    not with consistent results.

    Mike

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

    Comment

    • kaeli

      #3
      Re: Popup detection

      In article <409a00e3$0$632 3$65c69314@merc ury.nildram.net >,
      info@agony.com enlightened us with...[color=blue]
      > Hi there all,
      >
      > Is there a way, using Javascript, that you can detect if a popup window has
      > opened successfully?[/color]

      Kinda sorta, but not really.
      IOW, not reliably in all browsers.


      --
      --
      ~kaeli~
      Press any key to continue or any other key to quit



      Comment

      • Chris

        #4
        Re: Popup detection

        Original page has the following function:

        <script language="JavaS cript">
        var child=window.op en("blah.html", "nam","args ")

        function imHere(){
        //if this function is called then the popup is opened
        alert("YAY! no popup blocker for me, I'm free to annoy the world!")
        }
        </script>

        child page (blah.html or whatever uses this for verification
        <body onLoad="window. opener.imHere() ">



        "kaeli" <tiny_one@NOSPA M.comcast.net> wrote in message
        news:MPG.1b03fb 056ddf756b989e0 0@nntp.lucent.c om...[color=blue]
        > In article <409a00e3$0$632 3$65c69314@merc ury.nildram.net >,
        > info@agony.com enlightened us with...[color=green]
        > > Hi there all,
        > >
        > > Is there a way, using Javascript, that you can detect if a popup window[/color][/color]
        has[color=blue][color=green]
        > > opened successfully?[/color]
        >
        > Kinda sorta, but not really.
        > IOW, not reliably in all browsers.
        >
        >
        > --
        > --
        > ~kaeli~
        > Press any key to continue or any other key to quit
        > http://www.ipwebdesign.net/wildAtHeart
        > http://www.ipwebdesign.net/kaelisSpace
        >[/color]


        Comment

        • Richard Cornford

          #5
          Re: Popup detection

          Chris wrote:[color=blue]
          > Original page has the following function:
          >
          > <script language="JavaS cript">
          > var child=window.op en("blah.html", "nam","args ")
          >
          > function imHere(){
          > //if this function is called then the popup is opened
          > alert("YAY! no popup blocker for me, I'm free to annoy the world!")
          > }
          > </script>
          >
          > child page (blah.html or whatever uses this for verification
          > <body onLoad="window. opener.imHere() ">[/color]
          <snip>

          Having the page that is loaded in a new window report its presence will
          tell you that the page has loaded, from which you may infer that it was
          not pop-up blocked. That does not necessarily mean that the next attempt
          to open a new window will not be blocked (though it suggests that it is
          less likely).

          On the other hand, the failure of the new page to report its arrival (or
          the fact that it hasn't yet reported its arrival) cannot be used to
          deduce that there is a pop-up blocker operating as they are not the only
          factor in the failure of a page to load (or a long delay in loading).

          It is the pop-up blocker detection that cannot be done, it is only
          possible to make inferences about it, and only in such a way as would
          make it difficult to meaningfully respond to the inference that a window
          opening attempt had been blcoked.

          Richard.


          Comment

          • Chris

            #6
            Re: Popup detection

            Actually Richard, not to seem like an arse or anything, but the function i
            posted wasn't intended to be the complete thing, it was there to be adapted.
            adding a couple of lines is all that is needed to detect the presence of a
            popup blocker, but still; here is the "virtually" complete version
            a global variable
            var popBlocker=""

            and adapting the function imHere...

            function imHere(){
            //if this function is called then the popup is opened
            popBlocker="no"
            }

            function windowOpen{
            if(popBlocker== "" || popBlocker=="no "){
            popBlocker="tes ting..."
            var child=window.op en("blah.html", "nam","args ")
            }else{
            //popupBlocker was found
            }
            }

            "Richard Cornford" <Richard@litote s.demon.co.uk> wrote in message
            news:c7esb8$d1s $1$8300dec7@new s.demon.co.uk.. .[color=blue]
            > Chris wrote:[color=green]
            > > Original page has the following function:
            > >
            > > <script language="JavaS cript">
            > > var child=window.op en("blah.html", "nam","args ")
            > >
            > > function imHere(){
            > > //if this function is called then the popup is opened
            > > alert("YAY! no popup blocker for me, I'm free to annoy the world!")
            > > }
            > > </script>
            > >
            > > child page (blah.html or whatever uses this for verification
            > > <body onLoad="window. opener.imHere() ">[/color]
            > <snip>
            >
            > Having the page that is loaded in a new window report its presence will
            > tell you that the page has loaded, from which you may infer that it was
            > not pop-up blocked. That does not necessarily mean that the next attempt
            > to open a new window will not be blocked (though it suggests that it is
            > less likely).
            >
            > On the other hand, the failure of the new page to report its arrival (or
            > the fact that it hasn't yet reported its arrival) cannot be used to
            > deduce that there is a pop-up blocker operating as they are not the only
            > factor in the failure of a page to load (or a long delay in loading).
            >
            > It is the pop-up blocker detection that cannot be done, it is only
            > possible to make inferences about it, and only in such a way as would
            > make it difficult to meaningfully respond to the inference that a window
            > opening attempt had been blcoked.
            >
            > Richard.
            >
            >[/color]


            Comment

            • Richard Cornford

              #7
              Re: Popup detection

              Chris wrote:[color=blue]
              > Actually Richard, not to seem like an arse or anything,[/color]

              Top-posting evidence of a failure to comprehend logic to a programming
              newsgroup is likely to give that impression.

              <snip>[color=blue]
              > adding a couple of lines is all that is needed
              > to detect the presence of a popup blocker,[/color]

              The successful loading of a page in a new window could be used to infer
              the absence of a pop-up blocker, but failure to load (or very
              slow/delayed loading) cannot validly be used to infer the presence of
              pop-up blockers. There are just too many other factors influencing that
              situation.
              [color=blue]
              > but still; here is the
              > "virtually" complete version[/color]
              [color=blue]
              > a global variable
              > var popBlocker=""
              >
              > and adapting the function imHere...
              >
              > function imHere(){
              > //if this function is called then the popup is opened
              > popBlocker="no"
              > }
              >
              > function windowOpen{
              > if(popBlocker== "" || popBlocker=="no "){
              > popBlocker="tes ting..."
              > var child=window.op en("blah.html", "nam","args ")
              > }else{
              > //popupBlocker was found[/color]
              <snip>

              But even if you did decide to deduce that a pop-up blocker was operating
              when a page has not loaded, the test isn't worth much unless it is in a
              position to do something; to react to the (possibly erroneous)
              conclusion that a pop-up blocker was operating. As you have written it
              you are only in a position to act when you receive confirmation that the
              new window was not blocked, which is a situation that probably does not
              need any positive/remedial response.

              Richard.


              Comment

              • Chris

                #8
                Re: Popup detection

                Hmm... having just read your email again Richard (after having woken up this
                time..) - I apologise for completely missing your point

                /me skulks off feeling like a client....

                "Chris" <herakles_uk1@b tinternet.com> wrote in message
                news:c7lsfa$307 $1@hercules.bti nternet.com...[color=blue]
                > Actually Richard, not to seem like an arse or anything, but the function i
                > posted wasn't intended to be the complete thing, it was there to be[/color]
                adapted.[color=blue]
                > adding a couple of lines is all that is needed to detect the presence of a
                > popup blocker, but still; here is the "virtually" complete version
                > a global variable
                > var popBlocker=""
                >
                > and adapting the function imHere...
                >
                > function imHere(){
                > //if this function is called then the popup is opened
                > popBlocker="no"
                > }
                >
                > function windowOpen{
                > if(popBlocker== "" || popBlocker=="no "){
                > popBlocker="tes ting..."
                > var child=window.op en("blah.html", "nam","args ")
                > }else{
                > //popupBlocker was found
                > }
                > }
                >
                > "Richard Cornford" <Richard@litote s.demon.co.uk> wrote in message
                > news:c7esb8$d1s $1$8300dec7@new s.demon.co.uk.. .[color=green]
                > > Chris wrote:[color=darkred]
                > > > Original page has the following function:
                > > >
                > > > <script language="JavaS cript">
                > > > var child=window.op en("blah.html", "nam","args ")
                > > >
                > > > function imHere(){
                > > > //if this function is called then the popup is opened
                > > > alert("YAY! no popup blocker for me, I'm free to annoy the world!")
                > > > }
                > > > </script>
                > > >
                > > > child page (blah.html or whatever uses this for verification
                > > > <body onLoad="window. opener.imHere() ">[/color]
                > > <snip>
                > >
                > > Having the page that is loaded in a new window report its presence will
                > > tell you that the page has loaded, from which you may infer that it was
                > > not pop-up blocked. That does not necessarily mean that the next attempt
                > > to open a new window will not be blocked (though it suggests that it is
                > > less likely).
                > >
                > > On the other hand, the failure of the new page to report its arrival (or
                > > the fact that it hasn't yet reported its arrival) cannot be used to
                > > deduce that there is a pop-up blocker operating as they are not the only
                > > factor in the failure of a page to load (or a long delay in loading).
                > >
                > > It is the pop-up blocker detection that cannot be done, it is only
                > > possible to make inferences about it, and only in such a way as would
                > > make it difficult to meaningfully respond to the inference that a window
                > > opening attempt had been blcoked.
                > >
                > > Richard.
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • Dr John Stockton

                  #9
                  Re: Popup detection

                  JRS: In article <c7mm52$3jr$1@s parta.btinterne t.com>, seen in
                  news:comp.lang. javascript, Chris <herakles_uk1@b tinternet.com> posted at
                  Mon, 10 May 2004 01:33:22 :
                  [color=blue]
                  >Lines: 72[/color]

                  [color=blue]
                  >Hmm... having just read your email again Richard (after having woken up this
                  >time..) - I apologise for completely missing your point
                  >
                  >/me skulks off feeling like a client....
                  >
                  >"Chris" <herakles_uk1@b tinternet.com> wrote in message
                  >news:c7lsfa$30 7$1@hercules.bt internet.com...[color=green]
                  >> Actually Richard, not to seem like an arse or anything, but the function i
                  >> posted wasn't intended to be the complete thing, it was there to be[/color]
                  >adapted.[/color]


                  Do not top-post. Do not over-quote. Attribution lines should precede
                  other material, in almost all circumstances.

                  Read the newsgroup FAQ until you understand it.

                  --
                  © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
                  <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
                  <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
                  <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

                  Comment

                  • Matt Kruse

                    #10
                    Re: Popup detection

                    Dr John Stockton wrote:[color=blue]
                    > Do not top-post. Do not over-quote. Attribution lines should precede
                    > other material, in almost all circumstances.
                    > Read the newsgroup FAQ until you understand it.[/color]

                    Do not post to comp.lang.JAVAS CRIPT if your post contains no information
                    relating to JAVASCRIPT.

                    Suggesting better posting styles is one thing, and leads to a better group
                    of users. But lately, this group has been overrun by posting-style nazis who
                    focus more on posting correctly than actually discussing the topic of the
                    group.

                    Suggestions for better posting style should only be made in posts that
                    contain content that is relavent to the topic of the group.

                    --
                    Matt Kruse
                    Javascript Toolbox: http://www.mattkruse.com/javascript/


                    Comment

                    • Chris

                      #11
                      Re: Popup detection

                      not quite richard no, if the popup was not blocked, then the variable is set
                      to "Testing.."
                      and in that case the thing to do would be to test for that situation and
                      adapt the website to use the main window instead of the popup

                      as far as "if the popup didn't load for another reason than a popup blocker,
                      that's a little anal retentive, since either way the popup didn't load, you
                      then know about it and can counteract the problems, i don't think the
                      original plan was to detect a popup blocker, but to detect if the popup
                      failed to load, and adapt the way the website runs to avoid the EU missing
                      content

                      "Richard Cornford" <Richard@litote s.demon.co.uk> wrote in message
                      news:c7macq$ftn $1$830fa7a5@new s.demon.co.uk.. .

                      [:snip:]
                      [color=blue][color=green]
                      > > function windowOpen{
                      > > if(popBlocker== "" || popBlocker=="no "){
                      > > popBlocker="tes ting..."
                      > > var child=window.op en("blah.html", "nam","args ")
                      > > }else{
                      > > //popupBlocker was found[/color]
                      > <snip>
                      >
                      > But even if you did decide to deduce that a pop-up blocker was operating
                      > when a page has not loaded, the test isn't worth much unless it is in a
                      > position to do something; to react to the (possibly erroneous)
                      > conclusion that a pop-up blocker was operating. As you have written it
                      > you are only in a position to act when you receive confirmation that the
                      > new window was not blocked, which is a situation that probably does not
                      > need any positive/remedial response.
                      >
                      > Richard.
                      >
                      >[/color]


                      Comment

                      Working...