"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.29...
<snip>
You could create an object that mimics the window object,
but that would be quite a task. Whether naming that object,
'window', is allowable, and whether it would hide and override
the original object, are different questions altogether.
You could name it "Window".
Gecko browsers have a global function property with the name "Window"
(the window constructor) and probably would not like having it replaced.
I don't like the suggestion of - vVar = new window(); - in your other
post much either as "window" is a reference to the current window object
and not a function, so conforming ECMA Script implementations should be
expected to throw a TypeError exception at that line.
It sounds to me like the OP wants a general (I assume that assigning to
the location is just an example, else Lasse's response fits the
requirement) window impersonating object that will act as a sink for any
subsequent window interaction. That probably cannot be done 100% but
these objects:-
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(u rl);
this.document = new DocumentDummy(t his.location);
this.length = 0;
this.focus = forDummys;
this.close = function(){this .closed = true;};
this.navigator = window.navigato r;
this.resizeTo = (this.resizeBy = (this.moveBy =
(this.moveTo = forDummys)));
}
function LocationDummy(u rl){
this.href = url;
this.toString = function(){retu rn this.href;};
this.refresh = (this.replace = forDummys);
}
function DocumentDummy(l oc){
this.location = loc;
this.body = this.documentEl ement = {};
this.close = (this.open = (this.write = (this.writeln = forDummys)));
this.links = (this.anchors = (this.forms = (this.images = [])));
}
var forDummys = function(){retu rn;};
-have a reasonable go at it (and could be added to).
Richard.