By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,385 Members | 847 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,385 IT Pros & Developers. It's quick & easy.

Detect Function or Pop-Up Blocking

P: n/a
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?

QUESTION-2a:
How could I know if a particular JavaScript function has been declared?

QUESTION-2b:
How could I know if Window.Open has been redefined?

BACKGROUND:
NIS Pop-Up blocker inserts a JavaScript "SymWinOpen" function into a
client's HTML and then sets window.open = SymWinOpen. If I could detect
whether or not that "SymWinOpen" function name has been defined then I would
know if Norton's Pop-Up blocker was active.

Thanks for any help!

Dave
Jul 23 '05 #1
Share this Question
Share on Google+
23 Replies


P: n/a

"David McCulloch" <|@|.|> wrote in message
news:tq*******************@twister.rdc-kc.rr.com...
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?

QUESTION-2a:
How could I know if a particular JavaScript function has been declared?

QUESTION-2b:
How could I know if Window.Open has been redefined?

BACKGROUND:
NIS Pop-Up blocker inserts a JavaScript "SymWinOpen" function into a
client's HTML and then sets window.open = SymWinOpen. If I could detect
whether or not that "SymWinOpen" function name has been defined then I would know if Norton's Pop-Up blocker was active.


But why would you care? There are dozens of other popup blockers out there
as well.

If a user doesn't want a pop-up, what can you do about it?
Jul 23 '05 #2

P: n/a

"Noozer" <do*******@me.here> wrote in message
news:%Gnec.80341$Pk3.41272@pd7tw1no...

"David McCulloch" <|@|.|> wrote in message
news:tq*******************@twister.rdc-kc.rr.com...
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?

QUESTION-2a:
How could I know if a particular JavaScript function has been declared?

QUESTION-2b:
How could I know if Window.Open has been redefined?

BACKGROUND:
NIS Pop-Up blocker inserts a JavaScript "SymWinOpen" function into a
client's HTML and then sets window.open = SymWinOpen. If I could detect
whether or not that "SymWinOpen" function name has been defined then I

would
know if Norton's Pop-Up blocker was active.


But why would you care? There are dozens of other popup blockers out there
as well.

If a user doesn't want a pop-up, what can you do about it?


Thanks for your reply. I am writing a web application that uses pop-ups
(not for advertising). If anyone wants to use my service then they must be
able to accept pop-ups from my site. I simply want to alert them to that
need (and explain how to do it) if I know that pop-ups are being blocked.
Any ideas about any of my questions?
Jul 23 '05 #3

P: n/a
"Noozer" <do*******@me.here> wrote in message
news:%Gnec.80341$Pk3.41272@pd7tw1no...

"David McCulloch" <|@|.|> wrote in message
news:tq*******************@twister.rdc-kc.rr.com...
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?

QUESTION-2a:
How could I know if a particular JavaScript function has been declared?

QUESTION-2b:
How could I know if Window.Open has been redefined?

BACKGROUND:
NIS Pop-Up blocker inserts a JavaScript "SymWinOpen" function into a
client's HTML and then sets window.open = SymWinOpen. If I could detect
whether or not that "SymWinOpen" function name has been defined then I

would
know if Norton's Pop-Up blocker was active.


But why would you care? There are dozens of other popup blockers out there
as well.

If a user doesn't want a pop-up, what can you do about it?


You are correct that there are dozens of pop-up blockers in use today.
Sometime in 2004, Microsoft plans to release its own version with Windows XP
SP2. I simply want to be able to detect the most common pop-up blocking
tools. Currently, NIS seems to be #1.
Jul 23 '05 #4

P: n/a

"David McCulloch" <|@|.|> wrote in message
news:cR*******************@twister.rdc-kc.rr.com...
"Noozer" <do*******@me.here> wrote in message
news:%Gnec.80341$Pk3.41272@pd7tw1no...

"David McCulloch" <|@|.|> wrote in message
news:tq*******************@twister.rdc-kc.rr.com...
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?

QUESTION-2a:
How could I know if a particular JavaScript function has been declared?
QUESTION-2b:
How could I know if Window.Open has been redefined?

BACKGROUND:
NIS Pop-Up blocker inserts a JavaScript "SymWinOpen" function into a
client's HTML and then sets window.open = SymWinOpen. If I could detect whether or not that "SymWinOpen" function name has been defined then I would
know if Norton's Pop-Up blocker was active.


But why would you care? There are dozens of other popup blockers out there as well.

If a user doesn't want a pop-up, what can you do about it?


You are correct that there are dozens of pop-up blockers in use today.
Sometime in 2004, Microsoft plans to release its own version with Windows

XP SP2. I simply want to be able to detect the most common pop-up blocking
tools. Currently, NIS seems to be #1.


You're probably better off just testing to see if your new window opened at
all instead of trying to detect the different software packages. Just
because NIS is installed doesn't mean it's set to block windows.

I'm not sure how you'd go about checking to see if your window opened, but
I'm sure that someone here could tell you - assuming that it's possible.
Jul 23 '05 #5

P: n/a
> You're probably better off just testing to see if your new window opened
at
all instead of trying to detect the different software packages. Just
because NIS is installed doesn't mean it's set to block windows.
No, no... NIS only inserts the "SymWinOpen" function when it intends to
block pop-ups. If the "SymWinOpen" Javascript function has been defined in
a client's HTML, that means the client's NIS is configured to block pop-ups
and NIS inserted its SymWinOpen function into my HTML code after it reached
the client. If Javascript could test the existence of the "SymWinOpen"
function, it could know if NIS is configured to block pop-ups.
I'm not sure how you'd go about checking to see if your window opened, but
I'm sure that someone here could tell you - assuming that it's possible.


I would like to be more proactive than that (i.e., I would like to tell my
clients that there might be a problem before it happens), but if I can't
then I can't. Detecting an open window should be simple and I never thought
about doing that -- thanks for the idea! NIS overrides the open's return
code, but I might be able to test the window's presence and/or attributes.
You have given me something to research. Thanks again.

Dave
Jul 23 '05 #6

P: n/a
David McCulloch wrote:
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?
Unless you can add a version number (or range of version numbers) to
your specification for Norton Internet Security then the task is
impossible as it is not possible to tell how future versions will go
about pop-up blocking, and so impossible to tell what would need to be
detected.
QUESTION-2a:
How could I know if a particular JavaScript function has been
declared?
If the function has a name - if(typeof functionName == "function"){ /*
function exists */ }, though it is not difficult to arrange that
declared functions are anonymous or defined within a closure. And also
possible to arrange that a unique function name is generated for each
separate request.
QUESTION-2b:
How could I know if Window.Open has been redefined?
There is no - Window.Open - function, - window.open - might be converted
into a string and tested to see if it conforms to one of the many
parterres of strings produced by native code functions on various
browsers. Though that can be defeated by code such as:-

(function(){
var o = window.open;
var f = function(a,b,c){
return new Object();
};
f.toString = function(){return ''+o;};
window.open = f;
})();

- in which the new - window.open - function would report exactly the
same string as the original.

You biggest aid in the specific task of detecting past and current
Norton Internet Security versions is that Norton have never employed
anyone with javascript skills to write the code that they are inserting.
So, at present, it is cured and relatively easy to detect (and
circumvent once detected) but that may change, and is most likely to
change if they discover people targeting their code for detection.
BACKGROUND:
NIS Pop-Up blocker inserts a JavaScript "SymWinOpen" function into a
client's HTML and then sets window.open = SymWinOpen. If I could
detect whether or not that "SymWinOpen" function name has been
defined then I would know if Norton's Pop-Up blocker was active.


The most viable strategy for detecting pop-up blockers (apart form
rigorously testing the object returned from the - window.open - call) is
to try to open a window that loads a page that will report back its
successful opening. The problem is deciding how long to give it to open,
A slow modem connection, when the server and intervening network is
heavily loaded, might necessitate quite a long wait before it was safe
to assume that the page was not going to load. And when a page doesn't
show up in the allotted time span it is still not possible to tell
whether it was because of the actions of a pop-up blocker or whether the
user closed the window before it had time to load the page (Alt-F4 and
the like).

Given the multitude and diversity of pop-up blocking mechanisms, the
best strategy for dealing with the problem is to design web sites and
web applications so that they do not need to attempt to open new windows
(especially as some browsers cannot open new windows anyway). The
majority of the applications of new windows that I see could be done
without going outside of the original window, and are apparently used
because opening a new window is the "easy" approach. Of course it is
only easy when the pop-up blocking issues are ignored, add any viable
attempt to detect, circumvent or compensate for pop-up blocking and
opening new windows suddenly doesn't look nearly as simple in comparison
with the reliable alternatives.

Richard.
Jul 23 '05 #7

P: n/a
> Unless you can add a version number (or range of version numbers) to
your specification for Norton Internet Security then the task is
impossible as it is not possible to tell how future versions will go
about pop-up blocking, and so impossible to tell what would need to be
detected.
Understood. I simply want to be able to detect today's most common
situations where a window cannot be opened. I realize that I will have to
adapt to future changes.
If the function has a name - if(typeof functionName == "function"){ /*
function exists */ }, though it is not difficult to arrange that
declared functions are anonymous or defined within a closure. And also
possible to arrange that a unique function name is generated for each
separate request.
THANK YOU!!! That is the answer that will allow me to move forward. I
forgot about "typeof" (excuse me while I kick myself). I tested it and it
does what it needs to do. Thanks again! :-)
You biggest aid in the specific task of detecting past and current
Norton Internet Security versions is that Norton have never employed
anyone with javascript skills to write the code that they are inserting.
So, at present, it is cured and relatively easy to detect (and
circumvent once detected) but that may change, and is most likely to
change if they discover people targeting their code for detection.


True. In my case, however, the client really wants my pop-up windows so I
won't be the one whom Norton targets (I *will* probably be a victim of their
fallout, though). My windows aren't workarounds and they aren't abnoxious
advertisements. I have a real functional need that is best addressed by
opening new windows.

I have heard that Microsoft is planning to release their own version of
Pop-Up Blocking in Windows XP SP2. Fortunately for me, they plan to allow
clients to override their general settings by site. If Microsoft also
allows a developer to check a client's settings then legitimate developers
could benefit clients by giving them convenient instructions for changing
their settings.

Dave
Jul 23 '05 #8

P: n/a
Look up the JavaScript "try...catch" statements. I use them to handle all
popup blockers equally.

Wrap your code to open a popup in the try statement. If it fails for any
reason, use the catch statement to redirect to an explanatory page or
show an alert (for instance) asking the user to disable popup blocking
for your domain.

Brett
http://web.tampabay.rr.com/bmerkey/
Jul 23 '05 #9

P: n/a
"Brett Merkey" <bm*****@tampabay.rr.com> writes:
Look up the JavaScript "try...catch" statements. I use them to handle all
popup blockers equally.


The problem is that not all browsers support try/catch. And the one
feature that could be used to recover from that would be
.... try/catch. So, it will just give a syntax error and fail in such a
browser. You need a fallback for try/catch then :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #10

P: n/a
AM
David

I don't know if you've already tried this, but if you haven't it might
be worth a shot:

function is_popup_blocked() {
var mypopup=window.open("","win1",'width=10,height=10' );
if (mypopup){
mypopup.close();
return false;
}
return true;
}

This is of course dependant on how the blocker works internally. I
know this works with Google's basic popup blocker and IE, haven't
tried with NIS, maybe you can.

HTH
andy.
"David McCulloch" <|@|.|> wrote in message news:<tq*******************@twister.rdc-kc.rr.com>...
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?

QUESTION-2a:
How could I know if a particular JavaScript function has been declared?

QUESTION-2b:
How could I know if Window.Open has been redefined?

BACKGROUND:
NIS Pop-Up blocker inserts a JavaScript "SymWinOpen" function into a
client's HTML and then sets window.open = SymWinOpen. If I could detect
whether or not that "SymWinOpen" function name has been defined then I would
know if Norton's Pop-Up blocker was active.

Thanks for any help!

Dave

Jul 23 '05 #11

P: n/a
David McCulloch wrote:
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?

QUESTION-2a:
How could I know if a particular JavaScript function has been declared?

QUESTION-2b:
How could I know if Window.Open has been redefined?

BACKGROUND:
NIS Pop-Up blocker inserts a JavaScript "SymWinOpen" function into a
client's HTML and then sets window.open = SymWinOpen. If I could detect
whether or not that "SymWinOpen" function name has been defined then I would
know if Norton's Pop-Up blocker was active.

Thanks for any help!

Dave

The entire task of detecting popup blockers is too difficult to try.
Any method to do so might be thwarted by a new version of a popup blocker.

Also, If I use tabbed browsers, I can tell the browser to open popups in
a new tab, making it difficult to use the way you intend them to.

Instead, you might try to create an in-window popup. This method
requires you to create a a hidden DIV (I think SPAN works too) box that
can be dragged around (it will be a little tricky to get working, but I
think there are a lot of examples of dragable layers on the internet).
When you want the "popup", you make the "layer" visible. The user can
move it around the window, but not out of the screen. You can use an
IFRAME to display external content if you want.

All in all, I really like this method of popups. A popup blocker cannot
block it, since it is still part of the page. It is not as annoying as
popups, since it does not appear in a new window.

Good luck,
Brian

Jul 23 '05 #12

P: n/a
Brian Genisio wrote:
You can use an
IFRAME to display external content if you want.
I'd tried that near one year ago and had it work in IE, Mozilla and
Opera, but the emulation of window resizing was quite bad in Mozilla and
Opera, the iframe would't behave as I expected...
All in all, I really like this method of popups.


Me too, it's more reliable and you can provide more additional features,
like minimizing, transparency...
Regards,
Yep.
Jul 23 '05 #13

P: n/a
> The problem is that not all browsers support try/catch.

Serious commercial implementations assume the range of browser
versions and configurations compatible with making a profit.
Assuming otherwise makes no sense. With that in mind, all browsers
support try...catch.

Brett
Jul 23 '05 #14

P: n/a

Detecting NIS will be difficult but if you want to detect if a popup
window 'popped' or not then one method might be to have a hidden text
field in the parent window and open a popup window that contains a
javascript that writes a value to the hidden text field in the parent
window... Then, in your parent window, check to see if the hidden text
field has a value or not - If it doesn't then you know the popup has
been disabled... and... if it does have a value, then you know the
javascript in the popup executed which means the popup opened...

However... this makes the assumption that javascript is enabled (which,
if you're createing an application then I would guess you are targetting
folk who should have javascript enabled)...

Its only a suggested solution to your problem...

laters
randelld
Jul 23 '05 #15

P: n/a
Brett Merkey wrote:
The problem is that not all browsers support try/catch.
Serious commercial implementations assume the range of browser
versions and configurations compatible with making a profit.


Profits are made by taking money off people, for which the requirements
are support for HTTP (preferably including secure), HTML and
specifically HTML forms. There aren't many web browsers that do not
facilitate that (or could be configured not to).
Assuming otherwise makes no sense.
In much the same way as taking action that will positively prevent some
potential customers from doing business does not make sense.
With that in mind, all browsers
support try...catch.


That is wishful thinking. The sort of thought process that results in
developers reducing the potential for making profits for no better
reason than that they are not capable of doing any better (or even
perceiving that it is possible to do better).

But in the case of the proposed script try-catch does not help at all,
as many pop-up blocking techniques will not generate exceptions in the
script that attempts to open a window, while still not resulting in a
new window.

Richard.
Jul 23 '05 #16

P: n/a
AM wrote:
I don't know if you've already tried this, but if you haven't
it might be worth a shot:

function is_popup_blocked() {
var mypopup=window.open("","win1",'width=10,height=10' );
if (mypopup){
mypopup.close();
return false;
}
return true;
}

This is of course dependant on how the blocker works internally. I
know this works with Google's basic popup blocker and IE, haven't
tried with NIS, maybe you can.

<snip>

But it will not work in the case of Norton Internet Security, because it
inserts the script:-

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
return (new Object());
}

window.open = SymWinOpen;

- Which will return an Object from the - window.open - call, which will
pass the - if (mypopup) - test, and then error on the call to the -
close - method. Meaning the function will never return.

It also will not work with most external pop-up blocking software as
the - window.open - call will succeed and return a valid window
reference. The external pop-up blocker will probably not act until the
currently executing script has terminated (as the browser will probably
have the CPU tied up for the duration), then it will get a chance to
close the window (that is still usually so fast that the user never sees
the new window).

Richard.
Jul 23 '05 #17

P: n/a
Reply Via Newsgroup wrote:
<snip>
However... this makes the assumption that javascript is enabled
(which, if you're createing an application then I would guess you are
targetting folk who should have javascript enabled)...

<snip>

It is an odd piece of reasoning that a web application should be
expected to "target" users with javascript enabled. An Internet business
web application should be targeting the people who have enough money to
pay for the products or services offered, and there is no relationship
between having money and operating browsers with javascript enabled (or
any particular web browsers or computer hardware).

But a web application implies server-side scripting will be available,
and server-side scripting facilitates the guaranteeing what everything
can work for everyone regardless of client-side script support, browser
type or OS (even if it can be arranged to work better and quicker with
client-side scripting layered over a server-side fall-back). A
completely robust result can be achieved by implementing a robust
design. Introducing unnecessary dependencies would be a demonstration of
a skills shortfall on the part of the developer and not something that
is inherent to the system being created.

Richard.
Jul 23 '05 #18

P: n/a
am****@hotmail.com (AM) writes:

Please don't top post.
I don't know if you've already tried this, but if you haven't it might
be worth a shot:

function is_popup_blocked() {
var mypopup=window.open("","win1",'width=10,height=10' );
if (mypopup){
mypopup.close();
return false;
}
return true;
}

This is of course dependant on how the blocker works internally.


Oh yeah! I have seen at least one popup blocker that worked by
changing window.open to
function(){ return window; }
That is, it returns the *current* window. Then you close it. Whoops :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #19

P: n/a
<<But in the case of the proposed script try-catch does not help at all,
as many pop-up blocking techniques will not generate exceptions in the
script that attempts to open a window, while still not resulting in a
new window.>>

Do you know concretely of any popup blockers which generate an
un-try-catch-able error? Haven't found one yet.

Brett
Jul 23 '05 #20

P: n/a
Brett Merkey wrote:
<<But in the case of the proposed script try-catch does not help at
all, as many pop-up blocking techniques will not generate exceptions
in the script that attempts to open a window, while still not
resulting in a new window.>>

Do you know concretely of any popup blockers which generate an
un-try-catch-able error? Haven't found one yet.


You can't have been looking very hard then as external pop-up blockers
close additional browser windows from separate processes. They close new
windows at some unspecified (and unknowable) point after the window has
been created (usually shortly after). If the script has finished the
opening of the window, and exited the try-catch block in which it was
opened, when the window is closed, how is it going to generate an
exception?

But then a Proximatron filter inserting:-

(function(){
var o = window.open;
var onloadCount = 0;
var forDummys = function(){return;};
var f = function(a,b,c){
return new WindowDummy(a);
};
f.toString = function(){return ''+o;};
function WindowDummy(url){
this.self = this.window = this.parent =
this.frames = this.top = this;
this.opener = window;
this.open = window.open;
this.closed = false;
this.location = new LocationDummy(url);
this.document = new DocumentDummy(this.location);
this.length = 0;
this.focus = forDummys;
this.close = function(){this.closed = true;};
this.navigator = window.navigator;
}
function LocationDummy(url){
this.href = url;
this.toString = function(){return this.href;};
this.refresh = this.replace = forDummys;
}
function DocumentDummy(loc){
this.location = loc;
this.body = this.documentElement = {};
this.close = this.open = this.write = this.writeln = forDummys;
this.links = this.anchors = this.forms = this.images = [];
}
window.open = f;
})();

- would leave the window opening script hard pressed to generate an
error without also being to recklessly implemented for Internet use
anyway, as the window.open call will return an object with the features
and methods that would normally be expected of a new window reference.

Just because the current content-inserting/re-writing proxy based pop-up
blockers generally use crude and amateurish methods to replace the
window.open function does not mean that they all will, or that the ones
that currently do will continue to do so. In the pop-up blocking arms
race the pop-up blockers always have the advantage of being in a
position to bring bigger guns to bare because they are running locally
and can stuff as much additional script into a web page as they like
without significantly impacting on its download time, while the page
author faces an absolute upper limit if the result is to be a viable web
page.

Richard.
Jul 23 '05 #21

P: n/a
People who force internet users to see their pop-ups should be shot!
The reason while I bought the pop-up killers is that pop-ups as rude
and pathetic as email spams.

I hope you and thugs like you will continue to fail.

Kien

"David McCulloch" <|@|.|> wrote in message news:<tq*******************@twister.rdc-kc.rr.com>...
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?

QUESTION-2a:
How could I know if a particular JavaScript function has been declared?

QUESTION-2b:
How could I know if Window.Open has been redefined?

BACKGROUND:
NIS Pop-Up blocker inserts a JavaScript "SymWinOpen" function into a
client's HTML and then sets window.open = SymWinOpen. If I could detect
whether or not that "SymWinOpen" function name has been defined then I would
know if Norton's Pop-Up blocker was active.

Thanks for any help!

Dave

Jul 23 '05 #22

P: n/a

"Kien" <ca*********@hotmail.com> wrote in message
news:16**************************@posting.google.c om...
People who force internet users to see their pop-ups should be shot!
The reason while I bought the pop-up killers is that pop-ups as rude
and pathetic as email spams.

I hope you and thugs like you will continue to fail.

Kien


Kien,
If you are replying to me, I don't think you read my earlier messages.
You're safe. I am developing a service that actually makes GOOD use of
pop-ups (hard to believe that open.window could be used for anything other
than evil?). They aren't unsolicited and they aren't ads. Anyone who gets
them wants them actually has to request them. I wrote something for myself
a few years ago that I now want to make available to friends, family and
others in a more generic form.

Dave
Jul 23 '05 #23

P: n/a
Use DivLayers (i.e. <div>...</div>) as an alternative to pop-up windows.

Check out the posts on "Draggable Layers".

One of the posters created some pretty useful stuff!

"David McCulloch" <|@|.|> wrote in message
news:tq*******************@twister.rdc-kc.rr.com...
QUESTION-1:
How can I detect if Norton Internet Security is blocking pop-ups?

Jul 23 '05 #24

This discussion thread is closed

Replies have been disabled for this discussion.