Solved

detect popup blocker

Posted on 2003-11-17
17
3,317 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
  • 7
  • 4
  • 4
  • +1
17 Comments
 
LVL 25

Expert Comment

by:devic
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 16

Accepted Solution

by:
jaysolomon earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
just to let you know that it does work
0
 
LVL 16

Expert Comment

by:jaysolomon
Comment Utility
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
Comment Utility
@ jaysolomon,
what do you mean?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 16

Expert Comment

by:jaysolomon
Comment Utility
>>JScript.Encode

IE only
0
 
LVL 2

Author Comment

by:mattaustin
Comment Utility
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
Comment Utility
do you have this posted somewhere?  could you provide a url
0
 
LVL 25

Expert Comment

by:devic
Comment Utility


@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
Comment Utility
I no nuffin about the google popup blocker, maybe busta or devic do.
0
 
LVL 10

Expert Comment

by:Bustarooms
Comment Utility
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
Comment Utility
devic-  

how do i Use popup with user event ?


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

Expert Comment

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

Expert Comment

by:devic
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now