Ajax JavaScript CSS HTML 5 DOM

Window

Any XUL interface has a root container "window" tag is a window for the operating system. It is possible to open several windows in a Web application and thus to use several file with a window tag each one.

Attributes of window

xmlns

The namespace. For a XUL application, it is always:

xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"

id

The identifier, the name of the window.

title

The title displayed at top of the window.

orient

The direction of placement of graphical components, the default is horizontal and may be omitted, otherwise orient="vertical" is specified.

width

The width of the window.

height

Its height.

Opening a window

If one want to open a XUL application from an HTML page, one makes use of window.open. In this case, the word "window" refers to a DOM's object (and not the XUL tag) and open is a method of this object.
The required parameters are:
- The URL of the XUL file.
- The name of the interface, this is the id of the window tag we saw above.
- A third parameter is specific to XUL, it must hold the "chrome" code.

Here is the code to open our first program hello world:

window.open("hello.xul", "hello", "chrome,width=400,height=300");

Note that we have defined the size of the window at call, it would be useless if we would have defined its size in the file of the XUL interface.

Licence: (c) 2007 Xul.fr