BrowserWindowConstructorOptions Objekt
width
Integer (optional) - Fensterbreite in Pixel. Standard ist800
.height
Integer (optional) - Fensterhöhe in Pixel. Standard ist600
.x
Integer (optional) - (notwendig wenn y gegeben wird) der x-Versatz des Fensters zum Bildschirm. Standardmäßig wird das Fenster zentriert.y
Integer (optional) - (notwendig wenn x gegeben wird) der y-Versatz des Fensters zum Bildschirm. Standardmäßig wird das Fenster zentriert.useContentSize
boolean (optional) - Diewidth
undheight
Werte werden als Größe der angezeigten Webseite verwendet. D.h. die tatsächliche Größe des Fensters beinhaltet noch die Rahmengröße und ist deshalb etwas größer. Standard istfalse
.center
boolean (optional) - Zeige das Fenster in der Mitte des Bildschirms. Standard istfalse
.minWidth
Integer (optional) - die minimale Fensterbreite. Standard ist0
.minHeight
Integer (optional) - die minimale Fensterhöhe. Standard ist0
.maxWidth
Integer (optional) - die maximale Fensterbreite. Der Standardwert ist kein Limit.maxHeight
Integer (optional) - die maximale Fensterhöhe. Der Standardwert ist kein Limit.resizable
boolean (optional) - Gibt an, ob die Fenstergröße geändert werden kann. Standard isttrue
.movable
boolean (optional) macOS Windows - Whether window is movable. This is not implemented on Linux. Standard isttrue
.minimizable
boolean (optional) macOS Windows - Whether window is minimizable. This is not implemented on Linux. Standard isttrue
.maximizable
boolean (optional) macOS Windows - Whether window is maximizable. This is not implemented on Linux. Standard isttrue
.closable
boolean (optional) macOS Windows - Whether window is closable. This is not implemented on Linux. Standard isttrue
.focusable
boolean (optional) - Gibt an ob das Fenster fokussiert werden kann. Standard isttrue
. Unter Windows impliziert die Optionfocusable: false
die OptionskipTaskbar: true
. Unter Linux sorgtfocusable: false
dafür dass das Fenster nicht mehr mit dem Fenstermanager interagiert, d.h. das Fenster bleibt in allen Arbeitsoberflächen ganz oben.alwaysOnTop
boolean (optional) - Gibt an ob das Fenster immer über anderen Fenstern angezeigt werden soll. Standard istfalse
.fullscreen
boolean (optional) - Gibt an ob das Fenster im Vollbildmodus angezeigt werden soll. Wenn diese Option explizit auffalse
gesetzt wird, wird der Button für Vollbildmodus unter macOS versteckt oder deaktiviert. Standard istfalse
.fullscreenable
boolean (optional) - Gibt an ob das Fenster in den Vollbildmodus versetzt werden kann. Unter macOS gibt diese Option auch an, ob der Maximieren/Zoom Button das Fenster in den Vollbildmodus versetzt oder maximiert. Standard isttrue
.simpleFullscreen
boolean (optional) macOS - Use pre-Lion fullscreen on macOS. Standard istfalse
.skipTaskbar
boolean (optional) macOS Windows - Whether to show the window in taskbar. Standard istfalse
.hiddenInMissionControl
boolean (optional) macOS - Whether window should be hidden when the user toggles into mission control.kiosk
boolean (optional) - Gibt an, ob der Benutzer eingeschränkte Rechte besitzt (Kiosk-Modus). Standard istfalse
.Titel
string (optional) - der Standardfenstertitel. Standard ist"Electron"
. Wenn der HTML-Tag<title>
in der vonloadUrl()
geladenen HTML-Datei festgelegt ist, dann wird dieser Wert ignoriert.icon
(NativeImage | string) (optional) - The window icon. Es empfiehlt sich, unter Windows einICO
Icon zu verwenden, um die besten visuellen Effekte zu erreichen. Das Icon des ausführbaren Programmes wird verwendet, wenn dieser Wert nicht definiert wird.show
boolean (optional) - Gibt an ob das Fenster angezeigt wird, sobald es erstellt wurde. Standard isttrue
.paintWhenInitiallyHidden
boolean (optional) - Gibt an, ob der Renderer aktiv sein soll, wennshow
false
ist und das Fenster gerade erstellt wurde. Damitdocument.visibilityState
beim ersten Laden mitshow: false
korrekt funktioniert, sollten Sie diesen Wert auffalse
setzen. Wenn Sie diese Einstellung auffalse
festlegen, wird dasready-to-show
-Ereignis nicht ausgelöst. Standard isttrue
.frame
boolean (optional) - Specifyfalse
to create a frameless window. Standard isttrue
.parent
BrowserWindow (optional) - Geben Sie das übergeordnete Fenster an. Standard istnull
.modal
boolean (optional) - Gibt an, ob es das Fenster ein modales Fenster sein soll. Diese Funktion funktioniert nur, wenn das Fenster ein untergeordnetes Fenster ist. Standard istfalse
.acceptFirstMouse
boolean (optional) macOS - Whether clicking an inactive window will also click through to the web contents. Default isfalse
on macOS. This option is not configurable on other platforms.disableAutoHideCursor
boolean (optional) - Ob der Cursor ausgeblendet werden soll, wenn der Benutzer tippt. Standard istfalse
.autoHideMenuBar
boolean (optional) - Blendet die Menüleiste automatisch aus, es sei denn, dieAlt
Taste wird gedrückt. Standard istfalse
.enableLargerThanScreen
boolean (optional) macOS - Enable the window to be resized larger than screen. Only relevant for macOS, as other OSes allow larger-than-screen windows by default. Standard istfalse
.backgroundColor
string (optional) - The window's background color in Hex, RGB, RGBA, HSL, HSLA or named CSS color format. Alpha in #AARRGGBB format is supported iftransparent
is set totrue
. Der Standardwert ist#FFF
(weiß). Siehe win.setBackgroundColor für weitere Informationen.hasShadow
boolean (optional) - Gibt an, ob das Fenster einen Schatten haben soll. Standard isttrue
.opacity
number (optional) macOS Windows - Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0 (fully opaque). This is only implemented on Windows and macOS.darkTheme
boolean (optional) - Erzwingt ein dunkles Farbschema. Funktioniert nur mit manchen GTK+3 Desktopumgebungen. Standard istfalse
.transparent
boolean (optional) - Macht das Fenster transparent. Standard istfalse
. Unter Windows funktioniert es nur, wenn das Fenster rahmenlos ist.type
string (optional) - Der Fenstertyp. Standard ist ein normales Fenster. Mehr dazu kann weiter unten gelesen werden.visualEffectState
string (optional) macOS - Specify how the material appearance should reflect window activity state on macOS. Must be used with thevibrancy
property. Mögliche Werte sind:followWindow
- The backdrop should automatically appear active when the window is active, and inactive when it is not. This is the default.active
- The backdrop should always appear active.inactive
- The backdrop should always appear inactive.
titleBarStyle
string (optional) macOS Windows - The style of window title bar. Standard istdefault
. Mögliche Werte sind:default
- Results in the standard title bar for macOS or Windows respectively.hidden
- Results in a hidden title bar and a full size content window. On macOS, the window still has the standard window controls (“traffic lights”) in the top left. On Windows, when combined withtitleBarOverlay: true
it will activate the Window Controls Overlay (seetitleBarOverlay
for more information), otherwise no window controls will be shown.hiddenInset
macOS - Only on macOS, results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.customButtonsOnHover
macOS - Only on macOS, results in a hidden title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window. Beachte: Diese Option ist experimentell.
trafficLightPosition
Point (optional) macOS - Set a custom position for the traffic light buttons in frameless windows.roundedCorners
boolean (optional) macOS - Whether frameless window should have rounded corners on macOS. Standard isttrue
. Setting this property tofalse
will prevent the window from being fullscreenable.thickFrame
boolean (optional) - UseWS_THICKFRAME
style for frameless windows on Windows, which adds standard window frame. Fensterschatten und Fensteranimationen werden entfernt wenn dieser Wertfalse
ist. Standard isttrue
.vibrancy
string (optional) macOS - Add a type of vibrancy effect to the window, only on macOS. Can beappearance-based
,titlebar
,selection
,menu
,popover
,sidebar
,header
,sheet
,window
,hud
,fullscreen-ui
,tooltip
,content
,under-window
, orunder-page
.backgroundMaterial
string (optional) Windows - Set the window's system-drawn background material, including behind the non-client area. Can beauto
,none
,mica
,acrylic
ortabbed
. Siehe win.setBackgroundMaterial für weitere Informationen.zoomToPageWidth
boolean (optional) macOS - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. Iftrue
, the window will grow to the preferred width of the web page when zoomed,false
will cause it to zoom to the width of the screen. This will also affect the behavior when callingmaximize()
directly. Standard istfalse
.tabbingIdentifier
string (optional) macOS - Tab group name, allows opening the window as a native tab. Windows with the same tabbing identifier will be grouped together. This also adds a native new tab button to your window's tab bar and allows yourapp
and window to receive thenew-window-for-tab
event.webPreferences
WebPreferences (optional) - Einstellungen der Webseiten-Funktionen.devTools
boolean (optional) - Gibt an ob die Entwicklerwerkzeuge aktiviert sind. Falls dies auffalse
gesetzt ist, kannBrowserWindow.webContents.openDevTools()
nicht verwendet werden um die Entwicklerwerkzeuge zu öffnen. Standard isttrue
.nodeIntegration
boolean (optional) - Whether node integration is enabled. Standard istfalse
.nodeIntegrationsInWorker
boolean (optional) - Gibt an ob die Node Integration in Web Workern aktiviert ist. Standard istfalse
. Mehr dazu kann in Multithreading gefunden werden.nodeIntegrationInSubFrames
boolean (optional) - Experimental option for enabling Node.js support in sub-frames such as iframes and child windows. All your preloads will load for every iframe, you can useprocess.isMainFrame
to determine if you are in the main frame or not.preload
string (optional) - Gibt ein Skript an das vor allen anderen Skripten geladen wird bevor andere Skripte der Seite ausgeführt werden. Dieses Skript hat immer Zugriff auf die Node APIs, unabhängig davon ob die Node Integration aktiviert ist oder nicht. Der Wert sollte der absolute Pfad zum Skript sein. Wenn die Node Integration ausgeschaltet ist, kann das Preload Skript globale Node Symbole in den Globalen Scope zurückbringen. Siehe dieses Beispiel.sandbox
boolean (optional) - Wenn gesetzt, wird der Renderer des Fensters in einer Sandbox ausgeführt, wodurch es kompatibel mit der Chromium Sandbox wird und die Node.js Integration deaktiviert wird. Dies ist nicht das gleiche wienodeIntegration
, da die APIs die dem Preload Skript zur Verfügung stehen stärker limitiert sind. Lesen sie hier mehr über diese Option.session
Session (optional) - Sets the session used by the page. Instead of passing the Session object directly, you can also choose to use thepartition
option instead, which accepts a partition string. When bothsession
andpartition
are provided,session
will be preferred. Default is the default session.partition
string (optional) - Sets the session used by the page according to the session's partition string. Ifpartition
starts withpersist:
, the page will use a persistent session available to all pages in the app with the samepartition
. If there is nopersist:
prefix, the page will use an in-memory session. By assigning the samepartition
, multiple pages can share the same session. Default is the default session.zoomFactor
number (optional) - The default zoom factor of the page,3.0
represents300%
. Standard ist1.0
.javascript
boolean (optional) - Enables JavaScript support. Standard isttrue
.webSecurity
boolean (optional) - Whenfalse
, it will disable the same-origin policy (usually using testing websites by people), and setallowRunningInsecureContent
totrue
if this options has not been set by user. Standard isttrue
.allowRunningInsecureContent
boolean (optional) - Allow an https page to run JavaScript, CSS or plugins from http URLs. Standard istfalse
.images
boolean (optional) - Enables image support. Standard isttrue
.imageAnimationPolicy
string (optional) - Specifies how to run image animations (E.g. GIFs). Kannanimate
,animateOnce
odernoAnimation
sein. Standard istanimate
.textAreasAreResizable
boolean (optional) - Make TextArea elements resizable. Standard isttrue
.webgl
boolean (optional) - Enables WebGL support. Standard isttrue
.plugins
boolean (optional) - Whether plugins should be enabled. Standard istfalse
.experimentalFeatures
boolean (optional) - Enables Chromium's experimental features. Standard istfalse
.scrollBounce
boolean (optional) macOS - Enables scroll bounce (rubber banding) effect on macOS. Standard istfalse
.enableBlinkFeatures
string (optional) - A list of feature strings separated by,
, likeCSSVariables,KeyboardEventKey
to enable. Die vollständige Liste der unterstützten Funktione-strings finden Sie in der RuntimeEnabledFeatures.json5 Datei.disableBlinkFeatures
string (optional) - A list of feature strings separated by,
, likeCSSVariables,KeyboardEventKey
to disable. Die vollständige Liste der unterstützten Feature-strings finden Sie in der RuntimeEnabledFeatures.json5 Datei.defaultFontFamily
Object (optional) - Sets the default font for the font-family.standard
string (optional) - Defaults toTimes New Roman
.serif
string (optional) - Defaults toTimes New Roman
.sansSerif
string (optional) - Defaults toArial
.monospace
string (optional) - Defaults toCourier New
.cursive
string (optional) - Defaults toScript
.fantasy
string (optional) - Defaults toImpact
.math
string (optional) - Defaults toLatin Modern Math
.
defaultFontSize
Integer (optional) - Standart ist16
.defaultMonospaceFontSize
Integer (optional) - Standart ist13
.minimumFontSize
Integer (optional) - Standart ist0
.defaultEncoding
string (optional) - Defaults toISO-8859-1
.backgroundThrottling
boolean (optional) - Whether to throttle animations and timers when the page becomes background. Dies wirkt sich auch auf die Page Visibility API aus. When at least one webContents displayed in a single browserWindow has disabledbackgroundThrottling
then frames will be drawn and swapped for the whole window and other webContents displayed by it. Standardwert isttrue
.offscreen
boolean (optional) - Whether to enable offscreen rendering for the browser window. Standardwert istfalse
. See the offscreen rendering tutorial for more details.contextIsolation
boolean (optional) - Whether to run Electron APIs and the specifiedpreload
script in a separate JavaScript context. Defaults totrue
. The context that thepreload
script runs in will only have access to its own dedicateddocument
andwindow
globals, as well as its own set of JavaScript builtins (Array
,Object
,JSON
, etc.), which are all invisible to the loaded content. The Electron API will only be available in thepreload
script and not the loaded page. This option should be used when loading potentially untrusted remote content to ensure the loaded content cannot tamper with thepreload
script and any Electron APIs being used. Diese Option verwendet die gleiche Technik, wie sie von Chrome Content Scripts verwendet wird. You can access this context in the dev tools by selecting the 'Electron Isolated Context' entry in the combo box at the top of the Console tab.webviewTag
boolean (optional) - Whether to enable the<webview>
tag. Standardwert istfalse
. Note: Thepreload
script configured for the<webview>
will have node integration enabled when it is executed so you should ensure remote/untrusted content is not able to create a<webview>
tag with a possibly maliciouspreload
script. You can use thewill-attach-webview
event on webContents to strip away thepreload
script and to validate or alter the<webview>
's initial settings.additionalArguments
string[] (optional) - A list of strings that will be appended toprocess.argv
in the renderer process of this app. Useful for passing small bits of data down to renderer process preload scripts.safeDialogs
boolean (optional) - Whether to enable browser style consecutive dialog protection. Standard istfalse
.safeDialogsMessage
string (optional) - The message to display when consecutive dialog protection is triggered. If not defined the default message would be used, note that currently the default message is in English and not localized.disableDialogs
boolean (optional) - Whether to disable dialogs completely. OverridessafeDialogs
. Standard istfalse
.navigateOnDragDrop
boolean (optional) - Whether dragging and dropping a file or link onto the page causes a navigation. Standard istfalse
.autoplayPolicy
string (optional) - Autoplay policy to apply to content in the window, can beno-user-gesture-required
,user-gesture-required
,document-user-activation-required
. Defaults tono-user-gesture-required
.disableHtmlFullscreenWindowResize
boolean (optional) - Whether to prevent the window from resizing when entering HTML Fullscreen. Default isfalse
.accessibleTitle
string (optional) - An alternative title string provided only to accessibility tools such as screen readers. This string is not directly visible to users.spellcheck
boolean (optional) - Whether to enable the builtin spellchecker. Standard isttrue
.enableWebSQL
boolean (optional) - Whether to enable the WebSQL api. Standard isttrue
.v8CacheOptions
string (optional) - Enforces the v8 code caching policy used by blink. Accepted values arenone
- Disables code cachingcode
- Heuristic based code cachingbypassHeatCheck
- Bypass code caching heuristics but with lazy compilationbypassHeatCheckAndEagerCompile
- Same as above except compilation is eager. Default policy iscode
.
enablePreferredSizeMode
boolean (optional) - Whether to enable preferred size mode. The preferred size is the minimum size needed to contain the layout of the document—without requiring scrolling. Enabling this will cause thepreferred-size-changed
event to be emitted on theWebContents
when the preferred size changes. Standard istfalse
.
titleBarOverlay
Object | Boolean (optional) - Bei Verwendung eines framellosen Fensters in Verbindung mitwin.setWindowButtonVisibility(true)
auf macOS oder mittitleBarStyle
, so dass die Standard-Fenster-Kontrolle ("Ampel" auf macOS) sichtbar ist, diese Eigenschaft aktiviert das Fenstersteuerungs-Overlay JavaScript-APIs und CSS-Umgebungsvariablen. Specifyingtrue
will result in an overlay with default system colors. Standard istfalse
.color
String (optional) Windows - The CSS color of the Window Controls Overlay when enabled. Default is the system color.symbolColor
String (optional) Windows - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color.height
Integer (optional) macOS Windows - The height of the title bar and Window Controls Overlay in pixels. Default is system height.
When setting minimum or maximum window size with minWidth
/maxWidth
/ minHeight
/maxHeight
, it only constrains the users. It won't prevent you from passing a size that does not follow size constraints to setBounds
/setSize
or to the constructor of BrowserWindow
.
The possible values and behaviors of the type
option are platform dependent. Mögliche Werte sind:
- On Linux, possible types are
desktop
,dock
,toolbar
,splash
,notification
.- Der Typ
desktop
platziert das Fenster auf der Ebene des Hintergrundfensters (kCGDesktopWindowLevel - 1). Beachten sie jedoch, dass ein Desktop-Fenster keine focus, keyboard und mouse Events empfängt. Sie können weiterhin globalShortcut verwenden um Eingaben sparsam zu erhalten. - Der Typ
dock
erzeugt ein Dock-ähnliches Fensterverhalten. - Der Typ
toolbar
erzeugt ein Fenster mit einer Symbolleiste. - Der Typ
splash
verhält sich auf eine bestimmte Weise. Es ist kein Draggabel, auch wenn das CSS-Styling des Fensterkörpers -webkit-app-region: drag enthält. Dieser Typ wird häufig für Splash-Screens verwendet. - Der Typ
notification
erstellt ein Fenster, das sich wie eine Systembenachrichtigung verhält.
- Der Typ
- On macOS, possible types are
desktop
,textured
,panel
.- The
textured
type adds metal gradient appearance (NSWindowStyleMaskTexturedBackground
). - The
desktop
type places the window at the desktop background window level (kCGDesktopWindowLevel - 1
). Note that desktop window will not receive focus, keyboard or mouse events, but you can useglobalShortcut
to receive input sparingly. - The
panel
type enables the window to float on top of full-screened apps by adding theNSWindowStyleMaskNonactivatingPanel
style mask,normally reserved for NSPanel, at runtime. Also, the window will appear on all spaces (desktops).
- The
- On Windows, possible type is
toolbar
.