Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

detect popup blocker

Posted on 2003-11-17
17
Medium Priority
?
3,346 Views
Last Modified: 2012-08-13
I need a way to detect if the user is useing a popup blocker, and if so alert them to turn it off.  i dont know which way would be better to open a test windows and then somehow check if its open or if there is any other way..?
0
Comment
Question by:mattaustin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 4
  • +1
17 Comments
 
LVL 25

Expert Comment

by:devic
ID: 9765954
hi mattaustin,

like this :)
=================
<script language = JScript.Encode>#@~^6wAAAA==@#@&\CMPaWw!w,xPSkUNKh ^Kx0b.:vBfK~zW!P4l-+~C,wGw!2P(VG^0+D_w      Zsk1V,rF,k6PXKE,4l7+~r"P/C      m+^~k6PxKOv#p@#@&kW`Z2Kw;w*Ak      NGAcmWUWbDh`EWMlU0VHgB*@#@&r0vwGw!wbC^+DDcBkYDmrLtDPslU"vb@#@&nVknPmVn.D`BCUHhCX,r,NG      Y'BP(+^r\PzW!~~^4+lDnDeB#@#@&iUsAAA==^#~@</script>
0
 
LVL 25

Expert Comment

by:devic
ID: 9765995
oops sorry for mistake:
==============
<script language = JScript.Encode>#@~^8QAAAA==@#@&\CMPaWw!w,xPSkUNKh ^Kx0b.:vBfK~zW!P4l-+~C,wGw!2P(VG^0+D_w      Zsk1V,rF,k6PXKE,4l7+~r"P/C      m+^~k6PxKOv#p@#@&kW`Z2Kw;w*`hbx[GSRmGU6k.:vv6DC      3^XgE#)@#@&b0cwKw;2*      l^nDD`BkO.lbo4Y~:CUeBb8@#@&+^/n~PlVn.D`vl      zSlz,k,NW      Y'vP(+sk7+~zKE~,^tlY.ZB*8@#@&cU4AAA==^#~@</script>
0
 
LVL 25

Expert Comment

by:devic
ID: 9766020
monday ;(
this what i mean :)
=========================
<script>
var popup = window.confirm('Do you have a popup blocker?\nClick OK if you have OR Cancel if not');
if(!popup){window.confirm('frankly?')}
if(popup){alert('straight man!')}
else {alert('anyway i dont\' belive you!')}
</script>
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 16

Accepted Solution

by:
jaysolomon earned 375 total points
ID: 9766186
var nw = window.open("somewhere.asp","newWin");
if(!nw){
  alert("Please turn off that pop up blocker so i can show you something");
}


Maybe this wil work
0
 
LVL 10

Expert Comment

by:Bustarooms
ID: 9766475
jay,  i currently use something similar to your version

i put this at the beginning of my page

//open the test popup window for popup blocking detection
 var mine = window.open('','','width=1,height=1,scrollbars=no');
 if(mine)
    var popUpsBlocked = false
 else
    var popUpsBlocked = true
 mine.close()

then later on on my page
if(popUpsBlocked)
  alert('We have detected that you are using popup blocking software.\nIn order to access...');




end users of my pages would email my company all the time and half the time our response would be "You will need to turn off your.....".    I have implemented this on certain pages and have not had any of those emails from end users using those pages....so its going good so far
0
 
LVL 10

Expert Comment

by:Bustarooms
ID: 9766479
just to let you know that it does work
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9766535
Thats good Busta.

I haven't really thought much about the pop up blockers.

Nice script, keep your good code a coming ;)



@devic
Why use IE only stuff?
0
 
LVL 25

Expert Comment

by:devic
ID: 9766560
@ jaysolomon,
what do you mean?
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9766593
>>JScript.Encode

IE only
0
 
LVL 2

Author Comment

by:mattaustin
ID: 9766605
i guess i accepted the answer a little early , it dosn't seem to sop the google toolbar popup blocker...?
0
 
LVL 10

Expert Comment

by:Bustarooms
ID: 9766628
do you have this posted somewhere?  could you provide a url
0
 
LVL 25

Expert Comment

by:devic
ID: 9766640


@jaysolomon
ok this was just a joke. :)

@mattaustin,

google toolbar popup blocker is smart. And blocks only unrequested popups.
Use popup with user event, and the popup comes.
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9766646
I no nuffin about the google popup blocker, maybe busta or devic do.
0
 
LVL 10

Expert Comment

by:Bustarooms
ID: 9766663
meaning, if you have a link that opens a popup, Google will let it through for example
<a href="#" onclick="window.open('http://www.google.com','googleWin');return false;">Open Google</a>

but if you try

<body onload="window.open('http://www.google.com','googleWin');">

Google will swat that ish
0
 
LVL 2

Author Comment

by:mattaustin
ID: 9766666
devic-  

how do i Use popup with user event ?


http://www.mycoolphone.com/popuptest.html
0
 
LVL 25

Expert Comment

by:devic
ID: 9766681
if for example user clicks the link or button <input type=button onclick=mypopup()>
0
 
LVL 25

Expert Comment

by:devic
ID: 9766707
mattaustin,

here is my example, how to check if exists a window.


============================================
<html>
<head>
    <title>Untitled</title>
<script>
//created by devic
//super puper popup tester
function popUp(url, myname, w, h, scroll) {
     var winl = (screen.width - w) / 2;
var wint = ((screen.height - h) / 2)-20;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=0, status=0, resizable=0,menubar=0'
eval(myname+" = window.open(url, myname, winprops)");
if (parseInt(navigator.appVersion) >= 4) { eval(myname+".window.focus()"); }
}

function checkWindow(namez)
{
      try{
            if(eval("window."+namez+".document"))
            {
                  alert("Window \""+namez+"\" open");
            }
            else
            {
                  alert("Window \""+namez+"\" not found");
            }
      }
      catch(e)
      {
            alert("Window \""+namez+"\" not found");
      }
}
</script>
   
</head>

<body>

<a href="somePage.htm" onClick="popUp('','test1','295','300','no');return false;">Test1</a>
<br />
<a href="somePage.htm" onClick="popUp('','test2','295','300','no');return false;">Test2</a>
<p />
<input type="submit" value="test window test1" onClick="checkWindow('test1');" />
<input type="submit" value="test window test2" onClick="checkWindow('test2');" />
</form>
</body>
</html>
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question