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
The namespace. For a XUL application, it is always:xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
The identifier, the name of the window.
The title displayed at top of the window.
The direction of placement of graphical components, the default is horizontal and may be omitted, otherwise orient="vertical" is specified.
The width of the window.
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.
- Demo code.zip.