BrowserWindow
Properties
A string
property that defines an alternative title provided only to accessibility tools such as screen readers. This string is not directly visible to users.
A boolean
property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single Alt
key.
A boolean
property that specifies whether the window’s document has been edited.
A boolean
property that determines whether the window is excluded from the application’s Windows menu. false
by default.
A boolean
property that determines whether the window is in fullscreen mode.
A boolean
property that determines whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
A boolean
property that determines whether the window can be manually maximized by user.
A boolean
property that determines whether the menu bar should be visible.
A boolean
property that determines whether the window can be manually minimized by user.
A string
property that determines the pathname of the file the window represents, and the icon of the file will show in window's title bar.
A boolean
property that determines whether the window is in simple (pre-Lion) fullscreen mode.
A string
(optional) property that is equal to the tabbingIdentifier
passed to the BrowserWindow
constructor or undefined
if none was set.
A boolean
property that determines whether the window is visible on all workspaces.
A WebContents
object this window owns. All web page related events and operations will be done via it.
Functions
Replacement API for setBrowserView supporting work with multi browser views.
Adds a window as a tab on this window, after the tab for the window instance.
Resolves with a NativeImage
Closes the currently open Quick Look panel.
Starts or stops flashing the window to attract user's attention.
Gets the background color of the window in Hex (#RRGGBB
) format.
The BrowserView
attached to win
. Returns null
if one is not attached. Throws an error if multiple BrowserView
s are attached.
a sorted by z-index array of all BrowserViews that have been attached with addBrowserView
or setBrowserView
. The top-most BrowserView is the last element of the array.
All child windows.
The bounds
of the window's client area as Object
.
Contains the window's client area's width and height.
Contains the window's maximum width and height.
Window id in the format of DesktopCapturerSource's id. For example "window:1324:0".
Contains the window's minimum width and height.
The platform-specific handle of the window.
Contains the window bounds of the normal state
between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
The parent window or null
if there is no parent.
Contains the window's current position.
The pathname of the file the window represents.
Contains the window's width and height.
The custom position for the traffic light buttons in frameless window, null
will be returned when there is no custom position.
Hooks a windows message. The callback
is called when the message is received in the WndProc.
Invalidates the window shadow so that it is recomputed based on the current window shape.
Whether the window is always on top of other windows.
Whether the window can be manually closed by user.
Whether the window is destroyed.
Whether the window's document has been edited.
Whether the window can be focused.
Whether the window is in fullscreen mode.
Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
Whether the window will be hidden when the user toggles into mission control.
Whether the window can be manually maximized by user.
Whether the window is maximized.
Whether menu bar automatically hides itself.
Whether the menu bar is visible.
Whether the window can be manually minimized by the user.
Whether the window is minimized.
Whether the window can be manually resized by the user.
Whether the window is in simple (pre-Lion) fullscreen mode.
Whether the window is in Windows 10 tablet mode.
Whether the window is visible on all workspaces.
true
or false
depending on whether the message is hooked.
Merges all windows into one window with multiple tabs when native tabs are enabled and there is more than one open window.
Moves the current tab into a new window if native tabs are enabled and there is more than one tab in the current window.
Emitted when the window is set or unset to show always on top of other windows.
Emitted when an App Command is invoked. These are typically related to keyboard media keys or browser commands, as well as the "Back" button built into some mice on Windows.
Emitted when the window loses focus.
Emitted when the window is going to be closed. It's emitted before the beforeunload
and unload
event of the DOM. Calling event.preventDefault()
will cancel the close.
Emitted when the window is closed. After you have received this event you should remove the reference to the window and avoid using it any more.
Emitted when the window enters a full-screen state.
Emitted when the window enters a full-screen state triggered by HTML API.
Emitted when the window gains focus.
Emitted when the window is hidden.
Emitted when the window leaves a full-screen state.
Emitted when the window leaves a full-screen state triggered by HTML API.
Emitted when window is maximized.
Emitted when the window is minimized.
Emitted when the window is being moved to a new position.
Emitted once when the window is moved to a new position.
Emitted when the native new tab button is clicked.
Emitted when the document changed its title, calling event.preventDefault()
will prevent the native window's title from changing. explicitSet
is false when title is synthesized from file URL.
Emitted when the web page has been rendered (while not being shown) and window can be displayed without a visual flash.
Emitted after the window has been resized.
Emitted once when the window has finished being resized.
Emitted when the unresponsive web page becomes responsive again.
Emitted when the window is restored from a minimized state.
Emitted on trackpad rotation gesture. Continually emitted until rotation gesture is ended. The rotation
value on each emission is the angle in degrees rotated since the last emission. The last emitted event upon a rotation gesture will always be of value 0
. Counter-clockwise rotation values are positive, while clockwise ones are negative.
Emitted when window session is going to end due to force shutdown or machine restart or session log off.
Emitted when the window opens a sheet.
Emitted when the window has closed a sheet.
Emitted when the window is shown.
Emitted on 3-finger swipe. Possible directions are up
, right
, down
, left
.
Emitted when the system context menu is triggered on the window, this is normally only triggered when the user right clicks on the non-client area of your window. This is the window titlebar or any area you have declared as -webkit-app-region: drag
in a frameless window.
Emitted when the window exits from a maximized state.
Emitted when the web page becomes unresponsive.
Emitted before the window is moved. On Windows, calling event.preventDefault()
will prevent the window from being moved.
Emitted before the window is resized. Calling event.preventDefault()
will prevent the window from being resized.
Uses Quick Look to preview a file at a given path.
Remove the window's menu bar.
Selects the next tab when native tabs are enabled and there are other tabs in the window.
Selects the previous tab when native tabs are enabled and there are other tabs in the window.
Sets whether the window should show always on top of other windows. After setting this, the window is still a normal window, not a toolbox window which can not be focused on.
Sets the properties for the window's taskbar button.
This will make a window maintain an aspect ratio. The extra size allows a developer to have space, specified in pixels, not included within the aspect ratio calculations. This API already takes into account the difference between a window's size and its content size.
Controls whether to hide cursor when typing.
Sets whether the window menu bar should hide itself automatically. Once set the menu bar will only show when users press the single Alt
key.
Examples of valid backgroundColor
values:
This method sets the browser window's system-drawn background material, including behind the non-client area.
Sets whether the window can be manually closed by user. On Linux does nothing.
Resizes and moves the window's client area (e.g. the web page) to the supplied bounds.
Prevents the window contents from being captured by other apps.
Resizes the window's client area (e.g. the web page) to width
and height
.
Specifies whether the window’s document has been edited, and the icon in title bar will become gray when set to true
.
Disable or enable the window.
Changes whether the window can be focused.
Sets whether the window should be in fullscreen mode.
Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
Sets whether the window should have a shadow.
Sets whether the window will be hidden when the user toggles into mission control.
Makes the window ignore all mouse events.
Sets whether the window can be manually maximized by user. On Linux does nothing.
Sets the maximum size of window to width
and height
.
Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single Alt
key.
Sets whether the window can be manually minimized by user. On Linux does nothing.
Sets the minimum size of window to width
and height
.
Sets whether the window can be moved by user. On Linux does nothing.
Sets the opacity of the window. On Linux, does nothing. Out of bound number values are clamped to the 0, 1 range.
Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user.
Sets parent
as current window's parent window, passing null
will turn current window into a top-level window.
Moves window to x
and y
.
Sets progress value in progress bar. Valid range is 0, 1.0.
Sets the pathname of the file the window represents, and the icon of the file will show in window's title bar.
Sets whether the window can be manually resized by the user.
Setting a window shape determines the area within the window where the system permits drawing and user interaction. Outside of the given region, no pixels will be drawn and no mouse events will be registered. Mouse events outside of the region will not be received by that window, but will fall through to whatever is behind the window.
Changes the attachment point for sheets on macOS. By default, sheets are attached just below the window frame, but you may want to display them beneath a HTML-rendered toolbar. For example:
Enters or leaves simple fullscreen mode.
Makes the window not show in the taskbar.
Whether the buttons were added successfully
Sets the region of the window to show as the thumbnail image displayed when hovering over the window in the taskbar. You can reset the thumbnail to be the entire window by specifying an empty region: { x: 0, y: 0, width: 0, height: 0 }
.
Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.
On a Window with Window Controls Overlay already enabled, this method updates the style of the title bar overlay.
Raises browserView
above other BrowserView
s attached to win
. Throws an error if browserView
is not attached to win
.
Sets the touchBar layout for the current window. Specifying null
or undefined
clears the touch bar. This method only has an effect if the machine has a touch bar.
Adds a vibrancy effect to the browser window. Passing null
or an empty string will remove the vibrancy effect on the window.
Sets whether the window should be visible on all workspaces.
Set a custom position for the traffic light buttons in frameless window. Passing null
will reset the position to default.
Sets whether the window traffic light buttons should be visible.
Shows or hides the tab overview when native tabs are enabled.
Same as webContents.showDefinitionForSelection()
.
Shows the window but doesn't focus on it.
Toggles the visibility of the tab bar if native tabs are enabled and there is only one tab in the current window.
Unhooks all of the window messages.
Unhook the window message.
Unmaximizes the window.