Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Popup Blocker Detection using Javascript

Popup Blocker Detection using Javascript

Scheduled Pinned Locked Moved Web Development
javajavascripttoolshelp
14 Posts 7 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B babutkchn

    hi all, greetings. I've to detect the pop up blocker status using java script. I'm using the following code, which is taken from a site. But it is not working.can any one of you give me the soltuion for solve this issue. function detectPopupBlocker() { var test=window.open("","","directories=no,width=100,height=100,menubar=no,resizable=no,scorllbars=no,status=no,titlebar=no,top=0,location=no"); if(!test) { test.close(); alert("A popup blocker was detected."); } else { test.close(); alert("No PopUp Detected"); } } Thanks in Advance babu

    J Offline
    J Offline
    JUNEYT
    wrote on last edited by
    #5

    Try the following script it might work. function detectPopupBlocker() { var myTest = window.open("about:blank","","directories=no,height=100,width=100,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no"); if (!myTest) { alert("Please allow popups for this web site"); } else { myTest.close(); return; } }

    What a curious mind needs to discover knowledge is noting else than a pin-hole.

    B 1 Reply Last reply
    0
    • B babutkchn

      hi all, greetings. I've to detect the pop up blocker status using java script. I'm using the following code, which is taken from a site. But it is not working.can any one of you give me the soltuion for solve this issue. function detectPopupBlocker() { var test=window.open("","","directories=no,width=100,height=100,menubar=no,resizable=no,scorllbars=no,status=no,titlebar=no,top=0,location=no"); if(!test) { test.close(); alert("A popup blocker was detected."); } else { test.close(); alert("No PopUp Detected"); } } Thanks in Advance babu

      T Offline
      T Offline
      Torsten Mauz
      wrote on last edited by
      #6

      You'll also want to remove the marked line, as the window does't exist when that code executes you can't call the close method... if(!test) { test.close(); alert("A popup blocker was detected."); } else { test.close(); alert("No PopUp Detected"); }

      B 1 Reply Last reply
      0
      • B Bradml

        Did you remember to call the function onload?


        Brad Australian - Captain See Sharp on "Religion" any half intelligent person can come to the conclusion that pink unicorns do not exist.

        B Offline
        B Offline
        babutkchn
        wrote on last edited by
        #7

        yes.I've called in onload Untitled Page

        B 1 Reply Last reply
        0
        • J JUNEYT

          Try the following script it might work. function detectPopupBlocker() { var myTest = window.open("about:blank","","directories=no,height=100,width=100,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no"); if (!myTest) { alert("Please allow popups for this web site"); } else { myTest.close(); return; } }

          What a curious mind needs to discover knowledge is noting else than a pin-hole.

          B Offline
          B Offline
          babutkchn
          wrote on last edited by
          #8

          No.Its not working.its not even executing the if part of teh function.

          1 Reply Last reply
          0
          • T Torsten Mauz

            You'll also want to remove the marked line, as the window does't exist when that code executes you can't call the close method... if(!test) { test.close(); alert("A popup blocker was detected."); } else { test.close(); alert("No PopUp Detected"); }

            B Offline
            B Offline
            babutkchn
            wrote on last edited by
            #9

            I did that too.But it is not working.Could you tell any other solution for this issue.

            1 Reply Last reply
            0
            • B babutkchn

              yes.I've called in onload Untitled Page

              B Offline
              B Offline
              Bradml
              wrote on last edited by
              #10

              You do realize that the function is called "detectPopupBlocker"?


              Brad Australian - Captain See Sharp on "Religion" any half intelligent person can come to the conclusion that pink unicorns do not exist.

              B 1 Reply Last reply
              0
              • B Bradml

                You do realize that the function is called "detectPopupBlocker"?


                Brad Australian - Captain See Sharp on "Religion" any half intelligent person can come to the conclusion that pink unicorns do not exist.

                B Offline
                B Offline
                babutkchn
                wrote on last edited by
                #11

                since i used in the following method, i called up the "testPopUP()" function testPopUp() { detectPopupBlocker(); }

                1 Reply Last reply
                0
                • B babutkchn

                  hi all, greetings. I've to detect the pop up blocker status using java script. I'm using the following code, which is taken from a site. But it is not working.can any one of you give me the soltuion for solve this issue. function detectPopupBlocker() { var test=window.open("","","directories=no,width=100,height=100,menubar=no,resizable=no,scorllbars=no,status=no,titlebar=no,top=0,location=no"); if(!test) { test.close(); alert("A popup blocker was detected."); } else { test.close(); alert("No PopUp Detected"); } } Thanks in Advance babu

                  G Offline
                  G Offline
                  Guffa
                  wrote on last edited by
                  #12

                  Standard question #1: What do you mean by "not working"? Standard question #2: What error message do you get? Have you enabled Javascript error messages in the browser?

                  --- single minded; short sighted; long gone;

                  1 Reply Last reply
                  0
                  • B babutkchn

                    hi all, greetings. I've to detect the pop up blocker status using java script. I'm using the following code, which is taken from a site. But it is not working.can any one of you give me the soltuion for solve this issue. function detectPopupBlocker() { var test=window.open("","","directories=no,width=100,height=100,menubar=no,resizable=no,scorllbars=no,status=no,titlebar=no,top=0,location=no"); if(!test) { test.close(); alert("A popup blocker was detected."); } else { test.close(); alert("No PopUp Detected"); } } Thanks in Advance babu

                    W Offline
                    W Offline
                    WoutL
                    wrote on last edited by
                    #13

                    The code you posted is working fine for me (IE7). Make sure the site you are using is not:

                    • In your exception list
                    • On your local file-system
                    • On your network and opened with an UNC-path
                    • on your local IIS (ie localhost)

                    Wout Louwers

                    1 Reply Last reply
                    0
                    • B babutkchn

                      hi all, greetings. I've to detect the pop up blocker status using java script. I'm using the following code, which is taken from a site. But it is not working.can any one of you give me the soltuion for solve this issue. function detectPopupBlocker() { var test=window.open("","","directories=no,width=100,height=100,menubar=no,resizable=no,scorllbars=no,status=no,titlebar=no,top=0,location=no"); if(!test) { test.close(); alert("A popup blocker was detected."); } else { test.close(); alert("No PopUp Detected"); } } Thanks in Advance babu

                      V Offline
                      V Offline
                      Vasudevan Deepak Kumar
                      wrote on last edited by
                      #14

                      Try this snippet:http://lavanyadeepak.blogspot.com/2007/03/popup-blocker-detection.html[^]

                      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups