Describes the structure of a top-level window. It is the root node of a XUL document. It is by default a horizontally oriented box. As it is a box, all box attributes can be used. By default, the window will have a platform-specific frame around it.
To set an icon for the window, create a platform-specific icon file <windowid>
.ico and/or <windowid>
.xpm and place or install these files into the <mozilla-directory>
/chrome/icons/default/ directory. The <windowid> is the value of the id attribute on the window. This allows you to have a different icon for each window.
Without including the css file at "chrome://global/skin/", the window will not be stylized and will be invisible and glitchy when opened as a dialog.
Note: Starting in Gecko 1.9.2, you can detect when a window is activated or deactivated by watching for the "activate" and "deactivate" events. See Window activation events.
More information is available in the XUL tutorial.
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <!-- run this example using copy & paste in this live XUL editor: https://github.com/KM-200/xul --> <!-- Extremely recommended to keep this css include!! --> <window id="rootWnd" title="Register Online!" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox> <hbox> <image src="application_form.png"/> <description>Register Online!</description> </hbox> <groupbox align="start"> <caption label="Your Information"/> <radiogroup> <vbox> <hbox> <label control="your-fname" value="Enter first name:"/> <textbox id="your-fname" value="Johan"/> </hbox> <hbox> <label control="your-lname" value="Enter last name:"/> <textbox id="your-lname" value="Hernandez"/> </hbox> <hbox> <button oncommand="alert('save!')"> <description>Save</description> </button> </hbox> </vbox> </radiogroup> </groupbox> </vbox> </window>
trueto allow hardware layer managers to accelerate the window.
trueto disable chrome in the window. This is used to hide chrome when showing in-browser UI such as the
about:addonspage, and causes the toolbars to be hidden, with only the tab strip (and, if currently displayed, the add-on bar) left showing.
disablefastfind="true"on the root element of a XUL document, which is intended to be loaded in a tab, to disable the find bar for the tab with this document. This is used to prevent the find bar from being displayed when it's not supported by the content (such as in the Add-ons manager tab).
true, the top of the window's content area will begin at the top edge of the title bar, instead of below the title bar. This allows the window to draw in the title bar. This is supported only from
windowelements, and is ignored on platforms that don't support drawing into the title bar.
trueto have the chrome including the titlebar hidden.
window. It can have one of the following values:
This attribute is used to save and restore the state of a window (together with the
persist attribute) and for CSS styles (e.g. to hide the resizer grippy on maximized windows).
sizemodeattribute is not updated. This is done so that if a window is closed while minimized, its persisted
sizemodeattribute wouldn't be
Values for window type as found on MXR: http://mxr.mozilla.org/mozilla-release/search?string=windowtype
navigator:browser - Looks like if window has gBrowser it has this window type
devtools:scratchpad - Scratchpad windows
navigator:view-source - The view source windows
See also: DOM
window object methods
The error message "XML Parsing Error: undefined entity...<window" can be caused by a missing or unreachable DTD file referenced in the XUL file. A filename following the SYSTEM keyword in a DOCTYPE declaration may silently fail to load and the only error message will be an undefined entity error on the next XUL element.
To change the Icon to a window's title bar check this page on Window icons.
To add a favicon to the address bar and browser tab (ie dialog is not a popup) then use the following code snippet to use the html namespace and link.
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"> <!-- Icon from chrome --> <html:link rel="icon" href="chrome://myExtension/content/path/to/favicon.png"/> <!-- From a remote site --> <html:link rel="icon" href="http://www.mozilla.org/favicon.ico"/>
Since Firefox 3.6 the above listed code does not work correctly - it produces the following message: "Warning: XUL box for box element contained an inline link child, forcing all its children to be wrapped in a block". If this code is placed between
window tags it messes up all other controls on the window. If it is placed between
box tags, window controls are rendered fine, but still there is this error message. The problem can be solved as follows:
<html:link rel="icon" href="chrome://myExtension/content/path/to/favicon.png" style="display:none"/>
<html:head> <html:link rel="icon" href="chrome://myExtension/content/path/to/favicon.png"/> </html:head>