Window Opening Functions - Description

This script currently contains functions that:

All windows (except the full screen window) can be given status bars, scrollbars or other properties. If a window with the same HTML name is open, this window will be given focus when the new document is loaded into it.

A function to open a full-chrome window (one which has all the toolbars and menus) is also included. This mimics the behaviour of a link that has the target attribute set to _blank but has the benefit of giving focus to the window and returning a javascript reference to it.

A number of functions that allow popup windows to closely mimic modal dialog window behaviour are also included. Modal dialogs are windows that interrupt the user's use of an application and maintain focus until the user completes the task the dialog is presenting. The native Javascript alert() method is an example.

Note for Gecko-based browsers: Unless you specify otherwise, Gecko will assume that all images are inline and are given a default vertical-align of baseline which results in a gap of several pixels at the bottom of all images. What has this got to do with windows? If you size your popups to exactly fit an image, you'll end up with a vertical scrollbar (and maybe a horizontal one forced by the appearance of the vertical one). Set display: block on the image to make the gap disappear (which will remove the scrollbars).

Script Engine / Document Object Model Required

( Javascript 1.1 | JScript 2.0 | ECMAScript 1.0 ) & DOM 0

Modification History

2000/09/12

Posted.

2000/09/19

Added scrollbar support to all functions.

2000/11/01

Fixed bug that occured when a file not handled by the browser is opened in the new window in IE 4 on Windows.

2001/01/30

Added psuedo-modal dialog handling functions and a full-chrome window opener.

2001/05/17

Window dimensions now account for space taken up by scrollbar.

2001/06/05 v1.0

Added fix for IE4.x bug that prevents windows containing documents from other domains from being focused.

2001/06/12 v1.0.1

Centered and positioned windows can how have GUI elements other than the statusbar and scrollbars (ie. location, toolbar, etc).

2002/04/19 v1.0.2

Fixed bug in openMaxedWindow(); added openSizedFullChromeWindow().

2002/04/23 v1.0.3

Added getInnerHeight() and getInnerWidth().

2002/07/04 v1.0.4

Fix window vertical sizing in IE5.1 Mac.

2002/11/25 v1.0.5

Moved getInnerWidth() and getInnerHeight() into a separate library.

2002/11/26 v1.0.6

Added a openCenteredOnOpenerWindow() function, improved openMaxedWindow() and cleaned up some other code.

More about this script

Related to this script

Licensing

This script is released under a Creative Commons License.