Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

window

Beschreibt die Struktur eines Fensters. Dieses Element ist der Wurzelknoten eines XUL Dokuments. Das Fenster ist standardmäßig eine horizontal ausgerichtete Box und daher können alle box Attribute verwendet werden. Per Voreinstellung liegt um das Fenster ein plattform-spezifischer Rahmen.

Um ein Icon für das Fenster festzulegen, muss eine plattform-spezifische Icon-Datei <var><windowid></var>.ico und/oder <var><windowid></var>.xpm erstellt und in das <var><mozilla-verzeichnis></var>/chrome/icons/default/ Verzeichnis platziert oder installiert werden. Die <var><windowid></var> ist der Wert des id Attributs des Fensters. Dadurch wird für jedes Fenster ein unterschiedliches Icon ermöglicht.

Ohne die CSS Datei unter "chrome://global/skin/" einzubinden, wird das Fenster nicht durch CSS formatiert, unsichtbar und funktioniert nicht einwandfrei, wenn es als Dialog geöffnet wird.

Weitere Informationen sind im XUL Tutorial verfügbar.

Attribute
accelerated, drawintitlebar, height, hidechrome, id, lightweightthemes, lightweightthemesfooter, screenX, screenY, sizemode, title, width, windowtype

Beispiele

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!-- Extremely recommended to keep this css include!! -->
<window id="rootWnd" title="Register Online!"
        xmlns="https://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>

Attribute

accelerated
Type: boolean
Set this attribute to true to allow hardware layer managers to accelerate the window.
activetitlebarcolor
Typ: color string
Bestimmt die Hintergrundfarbe der Titelleiste eines Fensters, wenn es aktiv ist (Vordergrund). Außerdem versteckt dies die Trennlinie zwischen Titelleiste und Fensterinhalt. Dies trifft nur auf Mac OS Systeme zu.
drawintitlebar
Type: boolean
If this attribute is 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 window elements, and is ignored on platforms that don't support drawing into the title bar.
height
Type: string (representing an integer)
The preferred height of the element in pixels. The actual displayed height may be different if the element or its contents have a minimum or maximum height. The CSS height property may also be used.
hidechrome
Type: boolean
Set this attribute to true to have the chrome including the titlebar hidden.
id
Type: unique id
A unique identifier so that you can identify the element with. You can use this as a parameter to getElementById() and other DOM functions and to reference the element in style sheets.
inactivetitlebarcolor
Type: color string
Specify background color of the window's titlebar when it is inactive (background). Moreover this hides separator between titlebar and window contents. This affects only on Mac OS X.
lightweightthemes
Type: boolean
true if the window supports lightweight themes, otherwise false.
lightweightthemesfooter
Type: id
Specifies the ID of an element to which a lightweight theme's footer image will be applied.
screenX
Type: integer
The horizontal position at which the window appears on the screen.
screenY
Type: integer
The vertical position at which the window appears on the screen.
sizemode
Type: one of the values below
The state of the window. It can have one of the following values:
maximized
The window is maximized, and occupies the full size of the screen.
normal
The window appears in a normal state at the desired size.

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).

Note: When a window is minimized, the sizemode attribute is not updated. This is done so that if a window is closed while minimized, its persisted sizemode attribute wouldn't be minimized.

Setting this attribute does not change the window state. Use window.maximize(), window.restore(), or window.minimize() to change the window state.

To get the window state from JavaScript code, use window.windowState. Listen to the sizemodechange event dispatched to the DOM window to get notified when the window state changes.

 

title
Type: string
The text to appear in the title bar of the window.
width
Type: string (representing an integer)
The preferred width of the element. The value should not include a unit as all values are in pixels. The actual displayed width may be different if the element or its contents have a minimum or maximum width, or the size is adjusted by the flexibility or alignment of its parent. The CSS width property may also be used.
windowtype
Type: string
Set to a string which can be used to identify the type of window. This might be used, for example, to distinguish between a browser window and an editor window. Some of Mozilla's window handling functions use this attribute to group windows of the same type together.

Values for window type as found on MXR: https://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

 

Eigenschaften

Geerbte Eigenschaften
align, attributes, allowEvents, baseURI, boxObject, builder, childElementCount, childNodes, children, className, clientHeight, clientLeft, clientTop, clientWidth, collapsed, contextMenu, controllers, database, datasources, dir, firstChild, firstElementChild, flex, height, hidden, id, lastChild, lastElementChild, left, localName, maxHeight, maxWidth, menu, minHeight, minWidth, namespaceURI, nextElementSibling, nextSibling, nodeName, nodeType, nodeValue, observes, ordinal, orient, ownerDocument, pack, parentNode, persist, prefix, previousElementSibling, previousSibling, ref, resource, scrollHeight, scrollLeft, scrollTop, scrollWidth, statusText, style, tagName,textContent, tooltip, tooltipText, top, width

Methoden

Geerbte Methoden
element.addEventListener(), node.appendChild(), blur, click, node.cloneNode(), node.compareDocumentPosition(), element.dispatchEvent(), doCommand, focus, element.getAttribute(), element.getAttributeNode(), element.getAttributeNodeNS(), element.getAttributeNS(), element.getBoundingClientRect(), element.getClientRects(), getElementsByAttribute, getElementsByAttributeNS, element.getElementsByClassName(), element.getElementsByTagName(), element.getElementsByTagNameNS(), node.getFeature(), node.getUserData(), element.hasAttribute(), element.hasAttributeNS(), nodes.hasAttributes(), nodes.hasChildNodes(), node.insertBefore(), node.isDefaultNamespace(), node.isEqualNode(), node.isSameNode(), node.isSupported(), node.lookupNamespaceURI(), node.lookupPrefix(), node.normalize(), element.querySelector(), element.querySelectorAll(), element.removeAttribute(), element.removeAttributeNode(), element.removeAttributeNS(), node.removeChild(), element.removeEventListener(), node.replaceChild(), element.setAttribute(), element.setAttributeNode(), element.setAttributeNodeNS(), element.setAttributeNS(), node.setUserData()

Hinweise

Die Fehlermeldung "XML Parsing Error: undefined entity...<window" kann durch eine fehlende oder nicht erreichbare DTD Datei, die in der XUL Datei angegeben wurde, verursacht werden. Ein Dateiname mit einem SYSTEM Schlüsselwort in einer DOCTYPE Deklaration kann unter Umständen auch nicht geladen werden, ohne dass eine solche Fehlermeldung ausgegeben wird. In diesem Fall kann die Fehlermeldung ein nicht definierter Entity Fehler am nächsten XUL Element sein.

Verwandte Themen

Elemente
prefwindow, dialog, dialogheader
Fenster in Chrome

Benutzerhinweise

Um das Icon der Fenstertitelleiste zu ändern siehe: Fenster Icons.

Um ein Favicon zur Adressleiste und zum Tab hinzufügen, kann der folgende Codeschnipsel verwendet werden.

<window xmlns="https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
	xmlns:html="https://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="https://www.mozilla.org/favicon.ico"/>

Schlagwörter des Dokuments und Mitwirkende

Schlagwörter: 
 Mitwirkende an dieser Seite: fscholz, tee18cee06
 Zuletzt aktualisiert von: fscholz,