473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Popup detection

Hi there all,

Is there a way, using Javascript, that you can detect if a popup window has
opened successfully?
I'm tring to work out if someone is running popup blocking software or not.

Cheers,

@ndyB
Jul 23 '05 #1
10 3160
On Thu, 6 May 2004 10:10:11 +0100, Agony.COM <in**@agony.com> wrote:
Is there a way, using Javascript, that you can detect if a popup window
has opened successfully?


Check the Google groups archive for partial solutions. This topic has been
discussed more than once, but I believe the basic answer is, no. At least
not with consistent results.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #2
In article <40**********************@mercury.nildram.net>,
in**@agony.com enlightened us with...
Hi there all,

Is there a way, using Javascript, that you can detect if a popup window has
opened successfully?


Kinda sorta, but not really.
IOW, not reliably in all browsers.
--
--
~kaeli~
Press any key to continue or any other key to quit
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #3
Original page has the following function:

<script language="JavaScript">
var child=window.open("blah.html","nam","args")

function imHere(){
//if this function is called then the popup is opened
alert("YAY! no popup blocker for me, I'm free to annoy the world!")
}
</script>

child page (blah.html or whatever uses this for verification
<body onLoad="window.opener.imHere()">

"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <40**********************@mercury.nildram.net>,
in**@agony.com enlightened us with...
Hi there all,

Is there a way, using Javascript, that you can detect if a popup window has opened successfully?


Kinda sorta, but not really.
IOW, not reliably in all browsers.
--
--
~kaeli~
Press any key to continue or any other key to quit
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4
Chris wrote:
Original page has the following function:

<script language="JavaScript">
var child=window.open("blah.html","nam","args")

function imHere(){
//if this function is called then the popup is opened
alert("YAY! no popup blocker for me, I'm free to annoy the world!")
}
</script>

child page (blah.html or whatever uses this for verification
<body onLoad="window.opener.imHere()">

<snip>

Having the page that is loaded in a new window report its presence will
tell you that the page has loaded, from which you may infer that it was
not pop-up blocked. That does not necessarily mean that the next attempt
to open a new window will not be blocked (though it suggests that it is
less likely).

On the other hand, the failure of the new page to report its arrival (or
the fact that it hasn't yet reported its arrival) cannot be used to
deduce that there is a pop-up blocker operating as they are not the only
factor in the failure of a page to load (or a long delay in loading).

It is the pop-up blocker detection that cannot be done, it is only
possible to make inferences about it, and only in such a way as would
make it difficult to meaningfully respond to the inference that a window
opening attempt had been blcoked.

Richard.
Jul 23 '05 #5
Actually Richard, not to seem like an arse or anything, but the function i
posted wasn't intended to be the complete thing, it was there to be adapted.
adding a couple of lines is all that is needed to detect the presence of a
popup blocker, but still; here is the "virtually" complete version
a global variable
var popBlocker=""

and adapting the function imHere...

function imHere(){
//if this function is called then the popup is opened
popBlocker="no"
}

function windowOpen{
if(popBlocker=="" || popBlocker=="no"){
popBlocker="testing..."
var child=window.open("blah.html","nam","args")
}else{
//popupBlocker was found
}
}

"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
news:c7*******************@news.demon.co.uk...
Chris wrote:
Original page has the following function:

<script language="JavaScript">
var child=window.open("blah.html","nam","args")

function imHere(){
//if this function is called then the popup is opened
alert("YAY! no popup blocker for me, I'm free to annoy the world!")
}
</script>

child page (blah.html or whatever uses this for verification
<body onLoad="window.opener.imHere()">

<snip>

Having the page that is loaded in a new window report its presence will
tell you that the page has loaded, from which you may infer that it was
not pop-up blocked. That does not necessarily mean that the next attempt
to open a new window will not be blocked (though it suggests that it is
less likely).

On the other hand, the failure of the new page to report its arrival (or
the fact that it hasn't yet reported its arrival) cannot be used to
deduce that there is a pop-up blocker operating as they are not the only
factor in the failure of a page to load (or a long delay in loading).

It is the pop-up blocker detection that cannot be done, it is only
possible to make inferences about it, and only in such a way as would
make it difficult to meaningfully respond to the inference that a window
opening attempt had been blcoked.

Richard.

Jul 23 '05 #6
Chris wrote:
Actually Richard, not to seem like an arse or anything,
Top-posting evidence of a failure to comprehend logic to a programming
newsgroup is likely to give that impression.

<snip> adding a couple of lines is all that is needed
to detect the presence of a popup blocker,
The successful loading of a page in a new window could be used to infer
the absence of a pop-up blocker, but failure to load (or very
slow/delayed loading) cannot validly be used to infer the presence of
pop-up blockers. There are just too many other factors influencing that
situation.
but still; here is the
"virtually" complete version a global variable
var popBlocker=""

and adapting the function imHere...

function imHere(){
//if this function is called then the popup is opened
popBlocker="no"
}

function windowOpen{
if(popBlocker=="" || popBlocker=="no"){
popBlocker="testing..."
var child=window.open("blah.html","nam","args")
}else{
//popupBlocker was found

<snip>

But even if you did decide to deduce that a pop-up blocker was operating
when a page has not loaded, the test isn't worth much unless it is in a
position to do something; to react to the (possibly erroneous)
conclusion that a pop-up blocker was operating. As you have written it
you are only in a position to act when you receive confirmation that the
new window was not blocked, which is a situation that probably does not
need any positive/remedial response.

Richard.
Jul 23 '05 #7
Hmm... having just read your email again Richard (after having woken up this
time..) - I apologise for completely missing your point

/me skulks off feeling like a client....

"Chris" <he**********@btinternet.com> wrote in message
news:c7**********@hercules.btinternet.com...
Actually Richard, not to seem like an arse or anything, but the function i
posted wasn't intended to be the complete thing, it was there to be adapted. adding a couple of lines is all that is needed to detect the presence of a
popup blocker, but still; here is the "virtually" complete version
a global variable
var popBlocker=""

and adapting the function imHere...

function imHere(){
//if this function is called then the popup is opened
popBlocker="no"
}

function windowOpen{
if(popBlocker=="" || popBlocker=="no"){
popBlocker="testing..."
var child=window.open("blah.html","nam","args")
}else{
//popupBlocker was found
}
}

"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
news:c7*******************@news.demon.co.uk...
Chris wrote:
Original page has the following function:

<script language="JavaScript">
var child=window.open("blah.html","nam","args")

function imHere(){
//if this function is called then the popup is opened
alert("YAY! no popup blocker for me, I'm free to annoy the world!")
}
</script>

child page (blah.html or whatever uses this for verification
<body onLoad="window.opener.imHere()">

<snip>

Having the page that is loaded in a new window report its presence will
tell you that the page has loaded, from which you may infer that it was
not pop-up blocked. That does not necessarily mean that the next attempt
to open a new window will not be blocked (though it suggests that it is
less likely).

On the other hand, the failure of the new page to report its arrival (or
the fact that it hasn't yet reported its arrival) cannot be used to
deduce that there is a pop-up blocker operating as they are not the only
factor in the failure of a page to load (or a long delay in loading).

It is the pop-up blocker detection that cannot be done, it is only
possible to make inferences about it, and only in such a way as would
make it difficult to meaningfully respond to the inference that a window
opening attempt had been blcoked.

Richard.


Jul 23 '05 #8
JRS: In article <c7**********@sparta.btinternet.com>, seen in
news:comp.lang.javascript, Chris <he**********@btinternet.com> posted at
Mon, 10 May 2004 01:33:22 :
Lines: 72
Hmm... having just read your email again Richard (after having woken up this
time..) - I apologise for completely missing your point

/me skulks off feeling like a client....

"Chris" <he**********@btinternet.com> wrote in message
news:c7**********@hercules.btinternet.com...
Actually Richard, not to seem like an arse or anything, but the function i
posted wasn't intended to be the complete thing, it was there to be

adapted.

Do not top-post. Do not over-quote. Attribution lines should precede
other material, in almost all circumstances.

Read the newsgroup FAQ until you understand it.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #9
Dr John Stockton wrote:
Do not top-post. Do not over-quote. Attribution lines should precede
other material, in almost all circumstances.
Read the newsgroup FAQ until you understand it.


Do not post to comp.lang.JAVASCRIPT if your post contains no information
relating to JAVASCRIPT.

Suggesting better posting styles is one thing, and leads to a better group
of users. But lately, this group has been overrun by posting-style nazis who
focus more on posting correctly than actually discussing the topic of the
group.

Suggestions for better posting style should only be made in posts that
contain content that is relavent to the topic of the group.

--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/
Jul 23 '05 #10
not quite richard no, if the popup was not blocked, then the variable is set
to "Testing.."
and in that case the thing to do would be to test for that situation and
adapt the website to use the main window instead of the popup

as far as "if the popup didn't load for another reason than a popup blocker,
that's a little anal retentive, since either way the popup didn't load, you
then know about it and can counteract the problems, i don't think the
original plan was to detect a popup blocker, but to detect if the popup
failed to load, and adapt the way the website runs to avoid the EU missing
content

"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
news:c7*******************@news.demon.co.uk...

[:snip:]
function windowOpen{
if(popBlocker=="" || popBlocker=="no"){
popBlocker="testing..."
var child=window.open("blah.html","nam","args")
}else{
//popupBlocker was found

<snip>

But even if you did decide to deduce that a pop-up blocker was operating
when a page has not loaded, the test isn't worth much unless it is in a
position to do something; to react to the (possibly erroneous)
conclusion that a pop-up blocker was operating. As you have written it
you are only in a position to act when you receive confirmation that the
new window was not blocked, which is a situation that probably does not
need any positive/remedial response.

Richard.

Jul 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find...
4
by: danilo | last post by:
This Javascript + DHTML source code able to show a popup calendar to select one date in your web pages, complete the full sourcecode and its free distribuite (GNU lic)...
6
by: andrewkooi | last post by:
Greetings, I do not know whether such code exist but no harm asking: Is it possible for me to make visible a close button if the active window is a popup window or a new window (other than the...
26
by: Raffi | last post by:
Hi, We have a database application that runs in a popup Internet Explorer application window. The reason for this is to isolate the casual user from the address bar and the typical IE navigation...
1
by: Just D. | last post by:
Does anybody know the way to detect a popup blocker in the Internet Explorer? I was thinking that I know but the customers got a situation when I wasn't able to detect the Yahoo Toolbar Popup...
4
by: vickeybird | last post by:
I want to know if it is possible to detect if Pop up Blocker is enabled without trying to open a Pop Up windows. I'm trying to create a web analytics script and visible Pop up in case of disabled...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.