Entry
How do I open a new window on top (same position and size) of the opening window?
Jan 13th, 2001 06:16
Martin Honnen,
NN4 and NN6 should be able to do it as follows using
outerWidth/outerHeight:
var w = window.outerWidth;
var h = window.outerHeight;
var x = window.screenX;
var y = window.screenY;
var win =
open('http://JavaScript.FAQTs.com', 'windowName',
'outerWidth=' + w +
',outerHeight=' + h +
',left=' + x +
',top=' + y +
',scrollbars=1,menubar=1,location=1,status=1,toolbar=1,resizable=1'
);
With IE4+ you can try
var w = document.body.offsetWidth;
var h = document.body.offsetHeight;
var x = window.screenLeft;
var y = window.screenTop;
var win =
open('http://JavaScript.FAQTs.com', 'windowName',
'width=' + w +
',height=' + h +
',left=' + x +
',top=' + y +
',scrollbars=1,menubar=1,location=1,status=1,toolbar=1,resizable=1'
);
but it seems to have trouble to place the window at the right top
position.