M
Mickey Segal
On comp.lang.java.programmer we are discussing problems created for Java
programs by pop-up blockers (in the thread "showDocument blocked by new
microsoft pop-up blocker"). Our problem is that Java's showDocument method,
which opens new browser windows, is blocked by some pop-up blockers. The
showDocument method is blocked even if the user clicked a button in a Java
program to call showDocument. As a result, a type of user-initiated
functionality allowed in an HTML page is blocked in a Java applet.
We understand the Java programmers are collateral damage in a larger fight,
but would like advice on using JavaScript to detect pop-up blockers.
Our problem is restricted to certain environments. The Netscape and Safari
pop-up blockers do not block showDocument. In contrast, the Google and
Microsoft pop-up blockers do block showDocument. We would like to detect
pop-up blockers in appropriate environments and tell the user that the our
Java software won't work well unless they add the site to their pop-up
trusted sites.
We have seen various mentions of there being no good way to detect pop-up
blockers. However, since our needs seem restricted to Internet Explorer on
Windows our needs may be simpler than solving the general problem. Is the
following code appropriate for detecting pop-up blockers in Internet
Explorer for Windows (see it in action at
http://www.segal.org/js/pop_detect/):
Main page:
<script language = javascript>
result = window.open("popped.html", "popped", "width=10, height=10,
location=no, menubar=no, status=no, toolbar=no, scrollbars=no,
resizable=no");
if (result != null) html = "is not blocking";
else html = "is blocking";
document.write(html);
</script>
Popped-up page:
<script language = javascript>
window.close();
</script>
If this code would not be appropriate it would be helpful to know why, and
it would be even more helpful to know of code that would work better.
programs by pop-up blockers (in the thread "showDocument blocked by new
microsoft pop-up blocker"). Our problem is that Java's showDocument method,
which opens new browser windows, is blocked by some pop-up blockers. The
showDocument method is blocked even if the user clicked a button in a Java
program to call showDocument. As a result, a type of user-initiated
functionality allowed in an HTML page is blocked in a Java applet.
We understand the Java programmers are collateral damage in a larger fight,
but would like advice on using JavaScript to detect pop-up blockers.
Our problem is restricted to certain environments. The Netscape and Safari
pop-up blockers do not block showDocument. In contrast, the Google and
Microsoft pop-up blockers do block showDocument. We would like to detect
pop-up blockers in appropriate environments and tell the user that the our
Java software won't work well unless they add the site to their pop-up
trusted sites.
We have seen various mentions of there being no good way to detect pop-up
blockers. However, since our needs seem restricted to Internet Explorer on
Windows our needs may be simpler than solving the general problem. Is the
following code appropriate for detecting pop-up blockers in Internet
Explorer for Windows (see it in action at
http://www.segal.org/js/pop_detect/):
Main page:
<script language = javascript>
result = window.open("popped.html", "popped", "width=10, height=10,
location=no, menubar=no, status=no, toolbar=no, scrollbars=no,
resizable=no");
if (result != null) html = "is not blocking";
else html = "is blocking";
document.write(html);
</script>
Popped-up page:
<script language = javascript>
window.close();
</script>
If this code would not be appropriate it would be helpful to know why, and
it would be even more helpful to know of code that would work better.