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.