BrowserWindowConstructorOptions Object
width
Integer (opcional) - El ancho de la ventana en pixeles. Por defecto es800
.height
Integer (opcional) - La altura de la ventana en pixeles. Por defecto es600
.x
Integer (opcional) - (required si y es usado) Desplazamiento a la izquierda de la ventana de la pantalla. Por defecto es centrar en la ventana.y
Integer (opcional) - (required si x es usado) Desplazamiento superior de la ventana desde la pantalla. Por defecto es centrar en la ventana.useContentSize
boolean (opcional) -width
yheight
se utilizan como el tamaño de la página web. Esto significa que el tamaño actual de la ventana incluirá el tamaño del marco de la ventana y será un poco más grande. Por defecto esfalse
.center
boolean (opcional) - Muestra la ventana en el centro de la pantalla. Por defecto esfalse
.minWidth
Integer (opcional) - Ancho mínimo de a ventana. Por defecto es0
.minHeight
Integer (opcional) - Altura mínima de la ventana. Por defecto es0
.maxWidth
Integer (opcional) - Ancho máximo de la ventana. Por defecto no hay limite.maxHeight
Integer (opcional) - Altura máxima de la ventana. Por defecto no hay limite.resizable
boolean (opcional) - Si la ventana puede ser redimencionada. Por defecto estrue
.movable
boolean (optional) macOS Windows - Whether window is movable. This is not implemented on Linux. Por defecto estrue
.minimizable
boolean (optional) macOS Windows - Whether window is minimizable. This is not implemented on Linux. Por defecto estrue
.maximizable
boolean (optional) macOS Windows - Whether window is maximizable. This is not implemented on Linux. Por defecto estrue
.closable
boolean (optional) macOS Windows - Whether window is closable. This is not implemented on Linux. Por defecto estrue
.focusable
boolean (opcional) - si la ventana se puede enfocar. Por defecto estrue
. En Windows, la configuraciónfocusable: false
también quiere decir queskipTaskbar: true
. En Linux, la configuraciónfocusable: false
hace que la ventana deje de interactuar con wm, así la ventana siempre se mantendrá en la parte superior en todas las áreas de trabajo.alwaysOnTop
boolean (opcional) - Si la ventana debería permanecer siempre por ensima de otras ventanas. Por defecto esfalse
.fullscreen
boolean(opcional) - si la ventana debería mostrarse en pantalla completa. Cuando se establece explícitamentefalse
el botón de la pantalla completa estará oculta o deshabilitada en macOS. Por defecto esfalse
.fullscreenable
boolean (opcional) - si la ventana puede ponerse el modo pantalla completa. En macOS, también si el botón maximizar o acercarse debería alternar el modo pantalla completa o maximizar la ventana. Por defecto estrue
.simpleFullscreen
boolean (optional) macOS - Use pre-Lion fullscreen on macOS. Por defecto esfalse
.skipTaskbar
boolean (optional) macOS Windows - Whether to show the window in taskbar. Por defecto esfalse
.hiddenInMissionControl
boolean (optional) macOS - Whether window should be hidden when the user toggles into mission control.kiosk
boolean (opcional) - Si la ventana está en modo kiosk. Por defecto esfalse
.title
string (opcional) - Titulo de la ventana por defecto. Por defecto es"Electron"
. Si la etiqueta HTML<title>
es definida en el archivo HTML cargado porloadURL()
, esta propiedad será ignorada.icon
(NativeImage | string) (optional) - The window icon. En Windows, se recomienda usar iconosICO
para obtener mejores efectos visuales. También se se puede dejar sin definir, de esta manera se utilizará el icono del ejecutable.show
boolean (opcional) - Si la ventana debería ser mostrada cuando se crea. Por defecto estrue
.paintWhenInitiallyHidden
boolean (opcional) - Si el renderer debería estar activo cuandoshow
esfalse
y recién ha sido creado. Para quedocument.visibilityState
funcione correctamente en la primera carga conshow: false
debería establecer esto afalse
. Estableciendo esto afalse
causará que el eventoready-to-show
no se dispare. Por defecto estrue
.frame
boolean (opcional) - Especificafalse
para crear un Frameless Window.helloworlds Por defecto estrue
.parent
BrowserWindow (opcional) - Especifica la ventana padre. Por defecto esnull
.modal
boolean (opcional) - Si es una ventana modal. Esto sólo funciona cuando la ventana es una ventana hija. Por defecto esfalse
.acceptFirstMouse
booleano (opcional) macOS - Si hacer clic en una ventana inactiva también hará clic a través del contenido web. Default isfalse
on macOS. This option is not configurable on other platforms.disableAutoHideCursor
boolean (opcional) - Si ocultar el cursor cuando se está escriniendo. Por defecto esfalse
.autoHideMenuBar
boolean (opcional) - Auto ocultar la barra de menú a menos que la teclaAlt
este presionada. Por defecto esfalse
.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. Por defecto esfalse
.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
. Por defecto es#FFF
(blanco). See win.setBackgroundColor for more information.hasShadow
boolean (opcional) - Si la ventana debería tener una sombra. Por defecto estrue
.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 (opcional) - Fuerza el uso del tema obscuro en la ventana, solo funciona en algunos entornos de escritorio GTK+3. Por defecto esfalse
.transparent
boolean (opcional) - Hace la ventana tranparente. Por defecto esfalse
. En Windows, no funciona a menos que la ventana sea sin marco.type
string (opcional) - El tipo de ventana, por defecto es una ventana normal. Vea más sobre esto a continuación.visualEffectState
string (optional) macOS - Specify how the material appearance should reflect window activity state on macOS. Must be used with thevibrancy
property. Los valores posibles son:followWindow
- The backdrop should automatically appear active when the window is active, and inactive when it is not. Este es el valor predeterminado.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. Por defecto esdefault
. Los valores posibles son: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. Nota: Actualmente esta opción es experimental.
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. Por defecto estrue
. Setting this property tofalse
will prevent the window from being fullscreenable.thickFrame
boolean (opcional) - Utilice el estiloWS_THICKFRAME
para ventanas sin marco en Windows, la cual agrega un marco de ventana estándar. Configurarlo enfalse
eliminará la sombra de la ventana y las animaciones de la ventana. Por defecto estrue
.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. Puede serauto
,none
,mica
,acrylic
otabbed
. See win.setBackgroundMaterial for more information.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. Por defecto esfalse
.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) - Settings of web page's features.devTools
boolean (opcional) - Si se habilita el DevTools. Si se configura afalse
, no puede utilizarseBrowserWindow.webContents.openDevTools()
para abrir DevTools. Por defecto estrue
.nodeIntegration
boolean (optional) - Whether node integration is enabled. Por defecto esfalse
.nodeIntegrationInWorker
boolean (opcional) - Si la integración de nodos está habilitada en los trabajadores de la web. Por defecto esfalse
. Se pueden encontrar más detalles en Multithreading.nodeIntegrationInSubFrames
boolean (opcional) - Opcion experimental para habilitar soporte Node.js en sub-frames como iframes y ventas hijos. Todos tus preloads cargarán por cada iframe, puedes usarprocess.isMainFrame
para determinar si estás en el marco principal o no.preload
string (opcional) - Especifica un script que será cargado antes del otros scripts en la página. Este script siempre tendrá acceso al nodo APIs sin importar si la integración de nodos esté activada o no. El valor debería ser la ruta del archivo absoluto al script. Cuando la integración de nodos esta desactivada, la precarga del script puede reintroducir de vuelta al ámbito global los símbolos globales del Nodo. Ver ejemplo aquí.sandbox
boolean (opcional) - Si se configura, protegerá al renderizador asociado a la ventana, haciéndolo compatible con el sandbox de Chromium OS-level, deshabilitando el motor Node.js. Esto no es lo mismo que la opción denodeIntegration
y las APIs disponibles para el script de precarga son más limitadas. Leer más sobre la opción aquí.session
Session (opcional) - Configura la sesión usada por la página. En lugar de pasar directamente el objeto de la sesión, se puede optar por utilizar la opción departition
, la cual acepta una cadena de partición. Cuando se proporcionensession
ypartition
, se preferirásession
. Default es la sesión por defecto.partition
cadena (opcional) - Configura la sesión utilizada por la página según la cadena de partición de la sesión. Si lapartition
empieza conpersist:
, la página utilizará una sesión persistente disponible para todas las páginas en la partición con la mismapartition
. Si no está el prefijopersist:
, la página usara una sesión de la memoria interna. Al asignar la mismapartition
, las páginas múltiples pueden compartir la misma sesión. Default es la sesión por defecto.zoomFactor
number (optional) - The default zoom factor of the page,3.0
represents300%
. Por defecto es1.0
.javascript
boolean (optional) - Enables JavaScript support. Por defecto estrue
.webSecurity
boolean (opcional) - Cuando esfalse
, desactivará la política de same-origin (por lo general se utiliza cuando la gente prueba los sitios web), y configuraráallowRunningInsecureContent
atrue
en caso de que estas opciones no hayan sido configuradas por el usuario. Por defecto estrue
.allowRunningInsecureContent
boolean (optional) - Allow an https page to run JavaScript, CSS or plugins from http URLs. Por defecto esfalse
.images
boolean (optional) - Enables image support. Por defecto estrue
.imageAnimationPolicy
string (opcional) - Especifica cómo correr la animaciones de la imagen (P.e. GIFs). Puede seranimate
,animateOnce
onoAnimation
. Por defecto esanimate
.textAreasAreResizable
boolean (optional) - Make TextArea elements resizable. Default istrue
.webgl
boolean (optional) - Enables WebGL support. Por defecto estrue
.plugins
boolean (optional) - Whether plugins should be enabled. Por defecto esfalse
.experimentalFeatures
boolean (optional) - Enables Chromium's experimental features. Por defecto esfalse
.scrollBounce
boolean (optional) macOS - Enables scroll bounce (rubber banding) effect on macOS. Por defecto esfalse
.enableBlinkFeatures
string (opcional) - Una lista de cadenas de características separadas por,
, para habilitar comoCSSVariables,KeyboardEventKey
. La lista completa de cadenas distintivas soportadas pueden encontrarse en el archivo RuntimeEnabledFeatures.json5.disableblinkFeatures
string (opcional) - Una lista de cadenas distintivas separadas por,
,comoCSSVariables,KeyboardEventKey
para deshabilitar. La lista completa de cadenas características soportadas puede ser encontrada en el archivo RuntimeEnabledFeatures.json5.defaultFontFamily
Object (optional) - Sets the default font for the font-family.standard
string (opcional) - Por defecto esTimes New Roman
.serif
string (opcional) - Por defecto esTimes New Roman
.sansSerif
string (opcional) - Por defecto esArial
.monospace
string (opcional) - Por defecto esCourier New
.cursive
string (opcional) - Por defecto esScript
.fantasy
string (opcional) - Por defecto esImpact
.math
string (optional) - Defaults toLatin Modern Math
.
defaultFontSize
Integer (opcional) - Por defecto es16
.defaultMonospaceFontSize
Integer (opcional) - Por defecto es13
.minimumFontSize
Integer (opcional) - Por defecto es0
.defaultEncoding
string (opcional) - Por defecto esISO-8859-1
.backgroundThrottling
boolean (opcional) - Para acelerar animaciones y temporizadores cuando la página esta al fondo. Esto también afecta a Page Visibility API. 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. Por defecto estrue
.offscreen
boolean(optional) - Para habilitar el renderizado offscreen para el navegador de la ventana. Por defecto esfalse
. Para más detalles, ver offscreen rendering tutorial.contextIsolation
boolean(opcional) - Para ejecutar las APIs de Electron y el script especificadopreload
en un contexto JavaScript independiente. Por defecto estrue
. 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. Esta opción utiliza la misa técnica usada por Chrome Content Scripts. 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 (opcional) - Si se habilita o no el<webview>
tag. Por defecto esfalse
. Nota: El scriptpreload
configurado para el<webview>
tendrá la integración de nodos habilitada cuando se ejecuta por lo que hay que asegurarse que el contenido remoto o posiblemente dañino no sea capaz de crear una etiqueta de<webview>
con un scriptpreload
posiblemente malicioso. Puede utilizarse el eventowill-attach-webview
en webContents para quitar el scriptpreload
y validar o alterar la configuración inicial de<webview>
.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. Por defecto esfalse
.safeDialogsMessage
string (opcional) - El mensaje a mostrar cuando la protección de diálogo consecutivo es lanzada. So no se define el mensaje por defecto sería utilizado, note que actualmente el mensaje por defecto esta en Inglés y no localizado.disableDialogs
boolean (optional) - Whether to disable dialogs completely. OverridessafeDialogs
. Por defecto esfalse
.navigateOnDragDrop
boolean (optional) - Whether dragging and dropping a file or link onto the page causes a navigation. Por defecto esfalse
.autoplayPolicy
string (opcional) - Política de autoplay para aplicar al contenido en la ventana, puede serno-user-gesture-required
,user-gesture-required
,document-user-activation-required
. Por defecto ano-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. Esta cadena no es directamente visible para los usuarios.spellcheck
boolean (optional) - Whether to enable the builtin spellchecker. Por defecto estrue
.enableWebSQL
boolean (optional) - Whether to enable the WebSQL api. Por defecto estrue
.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. Por defecto esfalse
.
titleBarOverlay
Object | Boolean (optional) - When using a frameless window in conjunction withwin.setWindowButtonVisibility(true)
on macOS or using atitleBarStyle
so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay JavaScript APIs and CSS Environment Variables. Especificartrue
dará como resultado un overlay con los colores del sistema predeterminados. Por defecto esfalse
.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.
Cuando se configura el tamaño máximo o mínimo de la ventana con minWidth
/maxWidth
/ minHeight
/maxHeight
, solo limita a los usuarios. No impide pasar de un tamaño que no sigue las restricciones de tamaño asetBounds
/setSize
o al constructor de BrowserWindow
.
Los posibles valores y comportamientos de la opción type
son dependientes de la plataforma. Los valores posibles son:
- En linux, los tipos posibles son
desktop
,dock
,toolbar
,splash
,notification
.- The
desktop
type places the window at the desktop background window level (kCGDesktopWindowLevel - 1). However, note that a desktop window will not receive focus, keyboard, or mouse events. You can still use globalShortcut to receive input sparingly. - The
dock
type creates a dock-like window behavior. - The
toolbar
type creates a window with a toolbar appearance. - The
splash
type behaves in a specific way. It is not draggable, even if the CSS styling of the window's body contains -webkit-app-region: drag. This type is commonly used for splash screens. - The
notification
type creates a window that behaves like a system notification.
- The
- On macOS, possible types are
desktop
,textured
,panel
.- El tipo
textured
añade una aspecto de tono metálico (NSWindowStyleMaskTexturedBackground
). - El tipo
desktop
coloca la ventana en el nivel de la ventana de fondo de escritorio (kCGDesktopWindowLevel - 1
). Tenga en cuenta que la ventana de escritorio no recibirá enfoque alguno, ni eventos del ratón o del teclado, pero se puede utilizarglobalShortcut
para recibir input con moderación. - 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).
- El tipo
- En Windows, el tipo posible es
toolbar
.