Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

centering pop up windows



10:13 pm on Mar 12, 2003 (gmt 0)

10+ Year Member

What can I add to this script to make the pop up window in IE and Netscape centered.

<SCRIPT LANGUAGE="Javascript">
var browser1 = navigator.appName;
if (browser1 == "Microsoft Internet Explorer"){
var newWin = window.open("features.htm", "method_desc", "status=no,width=755,height=480");
var newWin = window.open("nfeatures.htm", "method_desc", "status=no,width=755,height=480");


1:57 am on Mar 13, 2003 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

IE and Netscape use different variables in the window.open() method's feature string to position a new window. So you'll need to declare 4 variables: top= and left= for IE; screenX= and screenY= for Netscape. Now on to the calculations.

You can use screen.width to calculate left= and screenY= values with (screen.width-755)/2. A parallel approach would generate the vertical coordinates.


Featured Threads

Hot Threads This Week

Hot Threads This Month