PDA

View Full Version : Killing pop up killers


havey
03-05-2003, 07:51 PM
I have a site that creates a pop-up, and i was wondering how i can script to determine if the user is using a pop-up blocker. I dont want to detect teh actual pop-up blocker program since there are so many out there, but maybe test the situation by creating a pop-up and if it is killed, to alert "disable your pop-up blocker" ??


please help,

dang those who abuse pop-ups.

havey
03-05-2003, 09:11 PM
Info: on my quest i have found that you can't use alert with a pop-up blocker, grrrr.....

any one out there to help me.....?

I'm having problems:

main.htm
<script>
function wait(){
//wait a sec
checkWin2()
}
function checkWin2(){
testVal = document.test.testBool.value
if (testVal == "true"){
document.write ("No blocker")
else{
document.write ("Blocker")
}
}
function checkWin(){
popWin = window.open("poptest.htm", "testWin","height=20,width=20")
setTimeout("wait()",100)
}

<body onLoad="checkWin()">
<form name="test">
<input name="testBool" value="false">
</form>

Roy Sinclair
03-05-2003, 09:21 PM
<script>
var popWin;
function wait(){
//wait a sec
checkWin2()
}
function checkWin2(){

if (popWin.closed){
document.write ("Blocker")
else{
document.write ("No Blocker")

}
}
function checkWin(){
popWin = window.open("poptest.htm", "testWin","height=20,width=20")
setTimeout("wait()",100)
}
</script>

havey
03-05-2003, 10:30 PM
no luck jack should be my name... nothing seems to work:

poptest.htm
<script>
window.opener.test.testBool.value = "true"
self.close
</script>


main.htm
<script>
function wait(){
//wait a sec
checkWin2()
}
function checkWin2(){
testVal = document.test.testBool.value
if (testVal == "true"){
document.write ("No blocker")
else{
document.write ("Blocker")
}
}
function checkWin(){
popWin = window.open("poptest.htm", "testWin","height=20,width=20")
setTimeout("wait()",100)
}

<body onLoad="checkWin()">
<form name="test">
<input

beetle
03-05-2003, 10:42 PM
Is that how the blockers work? The popup runs and is then killed? Or does it run at all?

When you install blocker software, that process is handled by the OS, and not by the browser. I doubt this is detectable.

Spookster
03-05-2003, 11:45 PM
what if the end user just closes the popup?

no way to tell which

beetle
03-06-2003, 12:01 AM
Besides, I was under the impression that the popup blockers only killed unrequested popups. True??

havey
03-06-2003, 12:11 AM
pop-up blockers kill pop-up as they load, Zone Alarm 3+ by default pop-up blocker is enabled, Earth link is now going beyond blocking ads by blocking all pop-ups. It is very detectable. The OS has nothing to do with it.

another bit of knowledge pop-up blockers block JS alerts.

beetle
03-06-2003, 12:22 AM
Ya, I get what you are saying, but I don't think get what I'm saying.

When a popup ( or any browser window for that matter ) is closed, there NO WAY to know what closed it that. You could use a cyclical process in the parent to determine when that window no longer exists, but as Spookster said, it could just be the user closing it. So I say again, the blocker software RUNS THE CLOSE command FROM THE OS on the window, just as if you were to click that little [X] yourself.

Sorry, but I'd be shocked as hell if you can pull this off.

havey
03-06-2003, 02:43 AM
Dudes, i realize the code seems closer to a window checking whether its pop-up was closed, but thats what pop-up bolckers do, they close windows. If i use this script to project a popWin behind index.html and the popwin self closes, i will know popup blockers are disabled. If the popwin is closed by a blocker then i can inform the user that the site requires blockers disabled. I don't need to know what closed the window either the user who never saw, or the blocker, the point is that popwins won't work on the website and the user is informed of that. Thanks for your input i figured it out.

<script>

var popWin = null;

function wait(){
//wait a sec
checkWin2();
}

function checkWin2() {
testVal = document.test.testBool.value;
if (popWin.closed)
document.test.testBool.value = "Pop up was closed!";
// alert("Pop up was closed!");

/*
if (testVal == "true"){
document.write("No blocker")
else{
document.write("Blocker")
}
*/
}


function checkWin() {
popWin = window.open("poptest.html", "testWin","height=20,width=20");
setInterval("wait()",1000);
}
</script>

<body onLoad="checkWin()">
<form name="test">
<input name="testBool" value="false">
</form>
</body>

beetle
03-06-2003, 02:56 AM
What if a user closes the popup before wait() runs the first time? I close popups pretty quick.

Are you gonna have something kill that interval?

joh6nn
03-06-2003, 05:46 AM
someone said that popup blockers block alert() boxes. can you back that up, 'cause i've never heard that before. specifically, which blockers you're talking about, would be great info to have.

also, why are you waiting a second before checking to see if the window exists? it could conceivably take a second ( several seconds, actually ) for the content of the window to load, but for the actual window to be created, that rarely takes as long as a second.

i'm not confident, that checking a window object against null will achieve the desired effect; i have no idea what a blocked popup would return, if anything. it could just as likely be undefined ( which actually makes more sense to me ), but i think the following is all you really need in order to check if a window has been successfully opened:

<script>
function checkWin(){
var popWin = window.open("", "testWin","height=20,width=20")
var popWinStatus = (popWin.closed || popWin == null) ? "Blocked" : "Success!";
document.write(popWinStatus);
}
</script>

PauletteB
03-06-2003, 09:14 AM
In as much as Norton Security - Ad Blocker is concerned:

Norton neither opens nor closes the window. It has replaced the script, example

function aimwindow(aimid) {
window.open("member.php?s=1ea3844da06f5bcc190faef9f5f6a... blah, blah) }

so that the source code of a page which has had a window blocked now reads:

function aimwindow(aimid) {
new Object() }

All window.open scripts will be treated as such, though the rules for blocking are easily changed, and can be done on the fly.

The term Ad Blocker is a bit misleading as this is actually a content 'find 'n replace.'

havey
03-06-2003, 03:01 PM
The script below works with Free Surfer MKII as it should, maybe someone can try it with Norton or Zone Alarm?:

main.htm

<script>
function checkPop(){
window.open("check.htm","")
}
</script>
<body onLoad="checkPop()">
<form name="popResult">
<input name="warning" value="Please Turn Off Pop-up blocker">
</form>


check.htm
<script>
window.opener.popResult.warning.value="No Pop-Up Killer Detected"
self.close()
</script>


.......Yes, the JS alert call does not work with bolckers, i'm surprised by this as well, i tied this:


<script>
popWin = window.open("", "test","height=20,width=20")

if (popWin){
popWin.close()
}
else{
alert("Enable pop windows")
}
</script>

And i didn't get an alert message, and then i thought...maybe, it kills the pop after javascript creates it (which circumvents my code). si i tried a simple alert message:

<script>
alert("It Works")
</script>

...the simple alert didn't work...and then i tried this:

<script>
popWin = window.open("", "test","height=20,width=20")

if (popWin){
popWin.close()
}
else{
document.write("Enable pop windows")
}
</script>

.....which also resulted in nothing.....


i tried this to see if the error reporting still worked and i got an error message, this was good, i used this code for that test:
<script>
popWin = window.open("", "test","height=20,width=20")

if (popWin.closed){
document.write("Enable pop windows")}
else{
popwin.close()
}
</script>

.....any comments?

GoHF
03-06-2003, 03:27 PM
Hi. About Norton's approach, I guess they parse the html as it is downloaded, so out-smarting their parser should be done on the fly, like:

win = "win"
dow = "dow.op"
opn ="en";
eval(win+dow+opn+"('"+URL+','+WinNAME+','+WinProperties+"')");

About circumventing other popup killers, my guess is there is no easy or flawless way to do it... but, give this ideas a try:

win = window.open(url,name,properties);
win.onerror = win.onunload = FunctionToTellUserHeIsAMoron (or simply tell him to disable popup killers);
win.onload = disablePreviousEvents;

The Unload Event fires just before the window is terminated. So you can be a prick and just keep poping the windows. That would be a Popup Killer DoS! Of course, this only works if the browser has the time to attach the functions to the events, which can be the cornerstone of it all. My guess is that the PKillers just check for child processes of the main window, and terminate them.

Under any circumstance, Popup Killers are a great anti-spam approach, although browsers should really consider making "url-blocking" an accessible reality. That way people could build their own lists of distrusted sites, instead of the most useless "trusted" sites list most browsers carry. And you could always get a site with blocking lists... now that would be something nice to see =)

joh6nn
03-06-2003, 04:35 PM
Originally posted by joh6nn
someone said that popup blockers block alert() boxes. can you back that up, 'cause i've never heard that before. specifically, which blockers you're talking about, would be great info to have.


Originally posted by havey
Yes, the JS alert call does not work with bolckers

...

you haven't really answered my question. WHICH blockers are you using in your tests?

havey
03-06-2003, 05:36 PM
Free Surfer MKII is the blocker i used to test with, to my knowledge it is popular and well used:
http://www.kolumbus.fi/eero.muhonen/FS/

Vladdy
03-06-2003, 05:42 PM
I think you are barking at a wrong tree. Your problem is right there:
Originally posted by havey
I have a site that creates a pop-up...
Whatever that is you do, I bet you can do it without annoying your visitors with a pop-up window.

liorean
03-06-2003, 05:44 PM
Popup blockers have four general methods of operation:

1. Act as a proxy filtering out open() function calls.
2. Tag into the JScript engine, and halt all open() function calls.
3. Tag into the JScript engine and on open() function calls return a container element that outwards acts all like a popup, but never generates a popup window.
4. Detect a popup, identify contents from a kill-list, and kill if on the list.


Each approach has it's good and bad points:

1. Almost all popups are killed. May cause a lot of javascript errors. Breaks any javascript openeing a new window. No bandwidth loss because you never load the popup contents.
2. Can either block all new windows created, or just those that aren't requested. May cause a lot of javascript errors and sometimes breaks any javascript trying to open a new window. No bandwidth loss.
3. A version of 2, really. No javascript errors, but instead a bit of bandwidth eaten because it DOES load the popup contents, just not to a window.
4. Only kills verified bad popups. Does eat some bandwidth. In a few cases causes javascript errors, but not many. Some such programs kill the popup after a delay of a few seconds, so the popups are still irritating, just less so.

// liorean <http://liorean.web-graphics.com/>

havey
03-06-2003, 05:58 PM
Vladdy, i agree but i didn't create the very large site, it was passed on to me to maintain, and the CEO likes it the way it is so, i'm working within my given budget and trying to keep everyone happy, plus the site uses the new storefront 6.0 shopping cart which uses popups, i could change, for 1 example: the "thankyou.aspx page from a pop-up to an autorefresh, cause those with pop-killers don't know that an order has been placed, but then i would be compelled to change all the pops, and that would change the functionality of the site.

beetle
03-06-2003, 06:17 PM
I think a much more elegant solution that would certainly stay within any sort of budget is to have a simple notice to ALL users notifying them about the possible adverse affects of using pop-up blockers while at the site.

That way, you cover your a** while saving time w/o trying to wrangle something out of the technology that is too unpredictable to use.

This is a classic "work the problem, not the symptom" scenario.

Problem
Users with pop-up blockers can't properly use site

Symptom
Javascript popups are blocked

Syptom Remedy
Try to defeat, circumvent, or detect blocking

Problem Remedy
Notify users of problems with blocking software

Recognizing this trend isn't always easy, but once you do, your choice and future course of action should be easy. The Problem Remedy is not only much easier and quicker, but more reliable."Let’s work the problem, people! Let’s not make things worse by guessing."
- Apollo 13 Flight Director, Gene Kranz

havey
03-06-2003, 06:17 PM
GoHF, very funny and creative!:p

beetle, i did do that as you suggested by fixing the problem with text, but unfortunately, not everyone reads, so i'm trying to incorporate both ideas. Plus, i like being on a mission/learning more, whether it is progresive or not

beetle
03-06-2003, 06:32 PM
Fair enough

As long as you aren't charging your client for your 'education'

havey
03-06-2003, 06:36 PM
Bettle, if you were here i'd buy you a drink;)

BTW - does Ad Blocker really rewrites the javascript code that's displayed?

That sounds unusual. Even so, I'd guess that my code would still display the form field with a value of "Please Turn Off Pop-up blocker"...

Quiet Storm
03-06-2003, 08:11 PM
I have a little popup that loads a Flash5 sound.

Could someone tell me if it gets blocked with these programs? :)

http://angelfire.com/mo3/cbch21/

PauletteB
03-07-2003, 07:54 AM
Quiet Storm

(Norton Security)

Date: 2003-03-07 Time: 01:46:10
Removed Entire OBJECT tag
From http://angelfire.com/mo3/cbch21/isIE.html
Because ActiveX blocking enabled

Date: 2003-03-07 Time: 01:46:10
Removed window.open('Sound.html','Music','width=220,height=115')
From http://angelfire.com/mo3/cbch21/isIE.html
Because Script-based Popup

Quiet Storm
03-07-2003, 10:59 PM
Ah, thank you PauletteB.

With those two removed/disabled, doesn't look like it will effect the site much, though. :)

Good!