WebContents Type
⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ❌ | Exported ❌
Instance members
| Instance member |
Description
|
Full Usage:
this.addWorkSpace path
Parameters:
string
Modifiers: inline |
Adds the specified path to DevTools workspace. Must be used after DevTools creation:
|
Full Usage:
this.adjustSelection (?start, ?end)
Parameters:
float
?end : float
Modifiers: inline |
Adjusts the current text selection starting and ending points in the focused frame by the given amounts. A negative amount moves the selection towards the beginning of the document, and a positive amount moves the selection towards the end of the document.Example:For a call of win.webContents.adjustSelection({ start: 1, end: 5 })Before:After:
|
Full Usage:
this.audioMuted
|
A boolean property that determines whether this page is muted. |
Full Usage:
this.backgroundThrottling
|
A boolean property that determines whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API. |
Full Usage:
this.beginFrameSubscription (?onlyDirty, ?callback)
Parameters:
bool
?callback : NativeImage * Rectangle -> unit
Modifiers: inline |
Begin subscribing for presentation events and captured frames, the callback will be called with callback(image, dirtyRect) when there is a presentation event.The image is an instance of NativeImage that stores the captured frame.The dirtyRect is an object with x, y, width, height properties that describes which part of the page was repainted. If onlyDirty is set to true, image will only contain the repainted area. onlyDirty defaults to false.
|
Full Usage:
this.capturePage (?rect, ?stayHidden, ?stayAwake)
Parameters:
Rectangle
?stayHidden : bool
?stayAwake : bool
Returns: Promise<NativeImage>
Modifiers: inline |
Resolves with a NativeImageCaptures a snapshot of the page within rect. Omitting rect will capture the whole visible page. The page is considered visible when its browser window is hidden and the capturer count is non-zero. If you would like the page to stay hidden, you should ensure that stayHidden is set to true.
|
Full Usage:
this.centerSelection ()
Modifiers: inline |
Centers the current text selection in web page. |
Full Usage:
this.close waitForBeforeUnload
Parameters:
bool
Modifiers: inline |
Closes the page, as if the web content had called window.close().If the page is successfully closed (i.e. the unload is not prevented by the page, or waitForBeforeUnload is false or unspecified), the WebContents will be destroyed and no longer usable. The destroyed event will be emitted.
|
Full Usage:
this.closeDevTools ()
Modifiers: inline |
Closes the devtools. |
Full Usage:
this.copy ()
Modifiers: inline |
Executes the editing command copy in web page. |
Full Usage:
this.copyImageAt (x, y)
Parameters:
int
y : int
Modifiers: inline |
Copy the image at the given position to the clipboard.
|
Full Usage:
this.cut ()
Modifiers: inline |
Executes the editing command cut in web page. |
|
A Debugger instance for this webContents.
|
Full Usage:
this.delete ()
Modifiers: inline |
Executes the editing command delete in web page. |
|
A WebContents | null property that represents the of DevTools WebContents associated with a given WebContents.> [!NOTE] Users should never store this object because it may become null when the DevTools has been closed.
|
Full Usage:
this.disableDeviceEmulation ()
Modifiers: inline |
Disable device emulation enabled by webContents.enableDeviceEmulation. |
Full Usage:
this.downloadURL (url, ?headers)
Parameters:
string
?headers : Record<string, string>
Modifiers: inline |
Initiates a download of the resource at url without navigating. The will-download event of session will be triggered.
|
Full Usage:
this.enableDeviceEmulation (screenPosition, screenSize, viewPosition, deviceScaleFactor, viewSize, scale)
Parameters:
ScreenPosition
screenSize : Size
viewPosition : Point
deviceScaleFactor : int
viewSize : Size
scale : float
Modifiers: inline |
Enable device emulation with the given parameters.
|
Full Usage:
this.endFrameSubscription ()
Modifiers: inline |
End subscribing for frame presentation events. |
Full Usage:
this.executeJavaScript (code, ?userGesture)
Parameters:
string
?userGesture : bool
Returns: Promise<obj>
Modifiers: inline |
A promise that resolves with the result of the executed code or is rejected if the result of the code is a rejected promise.Evaluates code in page.In the browser window some HTML APIs like requestFullScreen can only be invoked by a gesture from the user. Setting userGesture to true will remove this limitation.Code execution will be suspended until web page stop loading.
|
Full Usage:
this.findInPage (text, ?forward, ?findNext, ?matchCase)
Parameters:
string
?forward : bool
?findNext : bool
?matchCase : bool
Returns: int
Modifiers: inline |
The request id used for the request.Starts a request to find all matches for the text in the web page. The result of the request can be obtained by subscribing to found-in-page event.
|
Full Usage:
this.focus ()
Modifiers: inline |
Focuses the web page. |
|
A WebFrameMain | null property that represents the currently focused frame in this WebContents. Can be the top frame, an inner
|
Full Usage:
this.forcefullyCrashRenderer ()
Modifiers: inline |
Forcefully terminates the renderer process that is currently hosting this webContents. This will cause the render-process-gone event to be emitted with the reason=killed || reason=crashed. Please note that some webContents share renderer processes and therefore calling this method may also crash the host process for other webContents as well.Calling reload() immediately after calling this method will force the reload to occur in a new process. This should be used when this process is unstable or unusable, for instance in order to recover from the unresponsive event. |
Full Usage:
this.frameRate
|
An Integer property that sets the frame rate of the web contents to the specified number. Only values between 1 and 240 are accepted.Only applicable if offscreen rendering is enabled. |
|
Information about all Shared Workers.
|
Full Usage:
this.getBackgroundThrottling ()
Returns: bool
Modifiers: inline |
whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.
|
Full Usage:
this.getDevToolsTitle ()
Returns: string
Modifiers: inline |
the current title of the DevTools window. This will only be visible if DevTools is opened in undocked or detach mode.
|
Full Usage:
this.getFrameRate ()
Returns: int
Modifiers: inline |
If offscreen rendering is enabled returns the current frame rate.
|
Full Usage:
this.getMediaSourceId requestWebContents
Parameters:
WebContents
Returns: string
Modifiers: inline |
The identifier of a WebContents stream. This identifier can be used with navigator.mediaDevices.getUserMedia using a chromeMediaSource of tab. The identifier is restricted to the web contents that it is registered to and is only valid for 10 seconds.
|
Full Usage:
this.getOSProcessId ()
Returns: int
Modifiers: inline |
The operating system pid of the associated renderer process.
|
|
Get the system printer list.Resolves with a PrinterInfo[]
|
Full Usage:
this.getProcessId ()
Returns: int
Modifiers: inline |
The Chromium internal pid of the associated renderer. Can be compared to the frameProcessId passed by frame specific navigation events (e.g. did-frame-navigate)
|
Full Usage:
this.getTitle ()
Returns: string
Modifiers: inline |
The title of the current web page.
|
|
the type of the webContent. Can be backgroundPage, window, browserView, remote, webview or offscreen.
|
Full Usage:
this.getURL ()
Returns: string
Modifiers: inline |
The URL of the current web page.
|
Full Usage:
this.getUserAgent ()
Returns: string
Modifiers: inline |
The user agent for this web page.
|
Full Usage:
this.getWebRTCIPHandlingPolicy ()
Returns: string
Modifiers: inline |
Returns the WebRTC IP Handling Policy.
|
|
|
Full Usage:
this.getZoomFactor ()
Returns: float
Modifiers: inline |
the current zoom factor.
|
Full Usage:
this.getZoomLevel ()
Returns: float
Modifiers: inline |
the current zoom level.
|
|
A WebContents instance that might own this WebContents.
|
Full Usage:
this.id
Returns: int
|
A Integer representing the unique ID of this WebContents. Each ID is unique among all WebContents instances of the entire Electron application.
|
|
|
|
|
Full Usage:
this.inspectElement (x, y)
Parameters:
int
y : int
Modifiers: inline |
Starts inspecting element at position (x, y).
|
Full Usage:
this.inspectServiceWorker ()
Modifiers: inline |
Opens the developer tools for the service worker context. |
Full Usage:
this.inspectSharedWorker ()
Modifiers: inline |
Opens the developer tools for the shared worker context. |
Full Usage:
this.inspectSharedWorkerById workerId
Parameters:
string
Modifiers: inline |
Inspects the shared worker based on its ID.
|
Full Usage:
this.invalidate ()
Modifiers: inline |
Schedules a full repaint of the window this web contents is in.If offscreen rendering is enabled invalidates the frame and generates a new one through the 'paint' event. |
An IpcMain scoped to just IPC messages sent from this WebContents.IPC messages sent with ipcRenderer.send, ipcRenderer.sendSync or ipcRenderer.postMessage will be delivered in the following order:* contents.on('ipc-message')* contents.mainFrame.on(channel)* contents.ipc.on(channel)* ipcMain.on(channel)Handlers registered with invoke will be checked in the following order. The first one that is defined will be called, the rest will be ignored.* contents.mainFrame.handle(channel)* contents.handle(channel)* ipcMain.handle(channel)A handler or event listener registered on the WebContents will receive IPC messages sent from any frame, including child frames. In most cases, only the main frame can send IPC messages. However, if the nodeIntegrationInSubFrames option is enabled, it is possible for child frames to send IPC messages also. In that case, handlers should check the senderFrame property of the IPC event to ensure that the message is coming from the expected frame. Alternatively, register handlers on the appropriate frame directly using the WebFrameMain.ipc interface.
|
|
Full Usage:
this.isAudioMuted ()
Returns: bool
Modifiers: inline |
Whether this page has been muted.
|
Full Usage:
this.isBeingCaptured ()
Returns: bool
Modifiers: inline |
Whether this page is being captured. It returns true when the capturer count is greater than 0.
|
Full Usage:
this.isCrashed ()
Returns: bool
Modifiers: inline |
Whether the renderer process has crashed.
|
Full Usage:
this.isCurrentlyAudible ()
Returns: bool
Modifiers: inline |
Whether audio is currently playing.
|
Full Usage:
this.isDestroyed ()
Returns: bool
Modifiers: inline |
Whether the web page is destroyed.
|
Full Usage:
this.isDevToolsFocused ()
Returns: bool
Modifiers: inline |
Whether the devtools view is focused .
|
Full Usage:
this.isDevToolsOpened ()
Returns: bool
Modifiers: inline |
Whether the devtools is opened.
|
Full Usage:
this.isFocused ()
Returns: bool
Modifiers: inline |
Whether the web page is focused.
|
Full Usage:
this.isLoading ()
Returns: bool
Modifiers: inline |
Whether web page is still loading resources.
|
Full Usage:
this.isLoadingMainFrame ()
Returns: bool
Modifiers: inline |
Whether the main frame (and not just iframes or frames within it) is still loading.
|
Full Usage:
this.isOffscreen ()
Returns: bool
Modifiers: inline |
Indicates whether offscreen rendering is enabled.
|
Full Usage:
this.isPainting ()
Returns: bool
Modifiers: inline |
If offscreen rendering is enabled returns whether it is currently painting.
|
Full Usage:
this.isWaitingForResponse ()
Returns: bool
Modifiers: inline |
Whether the web page is waiting for a first-response from the main resource of the page.
|
|
the promise will resolve when the page has finished loading (see did-finish-load), and rejects if the page fails to load (see did-fail-load).Loads the given file in the window, filePath should be a path to an HTML file relative to the root of your application. For instance an app structure like this:Would require code like this
|
Full Usage:
this.loadURL (url, ?httpReferrer, ?userAgent, ?extraHeaders, ?postData, ?baseURLForDataURL)
Parameters:
string
?httpReferrer : U2<string, Referrer>
?userAgent : string
?extraHeaders : string
?postData : U2<UploadRawData, UploadFile>[]
?baseURLForDataURL : string
Returns: Promise<unit>
Modifiers: inline |
the promise will resolve when the page has finished loading (see did-finish-load), and rejects if the page fails to load (see did-fail-load). A noop rejection handler is already attached, which avoids unhandled rejection errors.Loads the url in the window. The url must contain the protocol prefix, e.g. the http:// or file://. If the load should bypass http cache then use the pragma header to achieve it.
|
|
A WebFrameMain property that represents the top frame of the page's frame hierarchy.
|
|
A NavigationHistory used by this webContents.
|
Full Usage:
this.offAudioStateChanged handler
Parameters:
EventInfo -> unit
Modifiers: inline |
Emitted when media becomes audible or inaudible.
|
Full Usage:
this.offBeforeInputEvent handler
Parameters:
IOnBeforeInputEvent -> unit
Modifiers: inline |
Emitted before dispatching the keydown and keyup events in the page. Calling event.preventDefault will prevent the page keydown/keyup events and the menu shortcuts.To only prevent the menu shortcuts, use setIgnoreMenuShortcuts:
|
|
|
Full Usage:
this.offBeforeMouseEvent handler
Parameters:
IOnBeforeMouseEvent -> unit
Modifiers: inline |
Emitted before dispatching mouse events in the page.Calling event.preventDefault will prevent the page mouse events.
|
Full Usage:
this.offBeforeMouseEvent handler
Parameters:
Event -> MouseInputEvent -> unit
Modifiers: inline |
Emitted before dispatching mouse events in the page.Calling event.preventDefault will prevent the page mouse events.
|
Full Usage:
this.offBlur handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the WebContents loses focus.
|
Full Usage:
this.offCertificateError handler
Parameters:
IOnCertificateError -> unit
Modifiers: inline |
Emitted when failed to verify the certificate for url.The usage is the same with the certificate-error event of app.
|
Full Usage:
this.offCertificateError handler
Parameters:
Event -> string -> string -> Certificate -> bool -> unit -> bool -> unit
Modifiers: inline |
Emitted when failed to verify the certificate for url.The usage is the same with the certificate-error event of app.
|
Full Usage:
this.offConsoleMessage handler
Parameters:
IOnConsoleMessage -> unit
Modifiers: inline |
Emitted when the associated window logs a console message.
|
Full Usage:
this.offConsoleMessage handler
Parameters:
Details -> int -> string -> int -> string -> unit
Modifiers: inline |
Emitted when the associated window logs a console message.
|
Full Usage:
this.offContentBoundsUpdated handler
Parameters:
IOnContentBoundsUpdated -> unit
Modifiers: inline |
Emitted when the page calls window.moveTo, window.resizeTo or related APIs.By default, this will move the window. To prevent that behavior, call event.preventDefault().
|
|
|
Full Usage:
this.offContextMenu handler
Parameters:
IOnContextMenu -> unit
Modifiers: inline |
Emitted when there is a new context menu that needs to be handled.
|
|
|
Full Usage:
this.offCursorChanged handler
Parameters:
IOnCursorChanged -> unit
Modifiers: inline |
Emitted when the cursor's type changes. The type parameter can be pointer, crosshair, hand, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, nwse-resize, col-resize, row-resize, m-panning, m-panning-vertical, m-panning-horizontal, e-panning, n-panning, ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, not-allowed, zoom-in, zoom-out, grab, grabbing, custom, null, drag-drop-none, drag-drop-move, drag-drop-copy, drag-drop-link, ns-no-resize, ew-no-resize, nesw-no-resize, nwse-no-resize, or default.If the type parameter is custom, the image parameter will hold the custom cursor image in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.
|
Full Usage:
this.offCursorChanged handler
Parameters:
Event -> string -> NativeImage -> float -> Size -> Point -> unit
Modifiers: inline |
Emitted when the cursor's type changes. The type parameter can be pointer, crosshair, hand, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, nwse-resize, col-resize, row-resize, m-panning, m-panning-vertical, m-panning-horizontal, e-panning, n-panning, ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, not-allowed, zoom-in, zoom-out, grab, grabbing, custom, null, drag-drop-none, drag-drop-move, drag-drop-copy, drag-drop-link, ns-no-resize, ew-no-resize, nesw-no-resize, nwse-no-resize, or default.If the type parameter is custom, the image parameter will hold the custom cursor image in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.
|
Full Usage:
this.offDestroyed handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when webContents is destroyed.
|
Full Usage:
this.offDevtoolsClosed handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is closed.
|
Full Usage:
this.offDevtoolsFocused handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is focused / opened.
|
Full Usage:
this.offDevtoolsOpenUrl handler
Parameters:
IOnDevtoolsOpenUrl -> unit
Modifiers: inline |
Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu.
|
Full Usage:
this.offDevtoolsOpenUrl handler
Parameters:
Event -> string -> unit
Modifiers: inline |
Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu.
|
Full Usage:
this.offDevtoolsOpened handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is opened.
|
Full Usage:
this.offDevtoolsReloadPage handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the devtools window instructs the webContents to reload
|
Full Usage:
this.offDevtoolsSearchQuery handler
Parameters:
IOnDevtoolsSearchQuery -> unit
Modifiers: inline |
Emitted when 'Search' is selected for text in its context menu.
|
Full Usage:
this.offDevtoolsSearchQuery handler
Parameters:
Event -> string -> unit
Modifiers: inline |
Emitted when 'Search' is selected for text in its context menu.
|
Full Usage:
this.offDidAttachWebview handler
Parameters:
IOnDidAttachWebview -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.offDidAttachWebview handler
Parameters:
Event -> WebContents -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.offDidChangeThemeColor handler
Parameters:
IOnDidChangeThemeColor -> unit
Modifiers: inline |
Emitted when a page's theme color changes. This is usually due to encountering a meta tag:
|
|
|
Full Usage:
this.offDidCreateWindow handler
Parameters:
IOnDidCreateWindow -> unit
Modifiers: inline |
Emitted after successful creation of a window via window.open in the renderer. Not emitted if the creation of the window is canceled from webContents.setWindowOpenHandler.See window.open() for more details and how to use this in conjunction with webContents.setWindowOpenHandler.
|
Full Usage:
this.offDidCreateWindow handler
Parameters:
BrowserWindow -> Details -> unit
Modifiers: inline |
Emitted after successful creation of a window via window.open in the renderer. Not emitted if the creation of the window is canceled from webContents.setWindowOpenHandler.See window.open() for more details and how to use this in conjunction with webContents.setWindowOpenHandler.
|
Full Usage:
this.offDidFailLoad handler
Parameters:
IOnDidFailLoad -> unit
Modifiers: inline |
This event is like did-finish-load but emitted when the load failed. The full list of error codes and their meaning is available here.
|
Full Usage:
this.offDidFailLoad handler
Parameters:
Event -> int -> string -> string -> bool -> int -> int -> unit
Modifiers: inline |
This event is like did-finish-load but emitted when the load failed. The full list of error codes and their meaning is available here.
|
Full Usage:
this.offDidFailProvisionalLoad handler
Parameters:
IOnDidFailProvisionalLoad -> unit
Modifiers: inline |
This event is like did-fail-load but emitted when the load was cancelled (e.g. window.stop() was invoked).
|
Full Usage:
this.offDidFailProvisionalLoad handler
Parameters:
Event -> int -> string -> string -> bool -> int -> int -> unit
Modifiers: inline |
This event is like did-fail-load but emitted when the load was cancelled (e.g. window.stop() was invoked).
|
Full Usage:
this.offDidFinishLoad handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the navigation is done, i.e. the spinner of the tab has stopped spinning, and the onload event was dispatched.
|
Full Usage:
this.offDidFrameFinishLoad handler
Parameters:
IOnDidFrameFinishLoad -> unit
Modifiers: inline |
Emitted when a frame has done navigation.
|
Full Usage:
this.offDidFrameFinishLoad handler
Parameters:
Event -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a frame has done navigation.
|
Full Usage:
this.offDidFrameNavigate handler
Parameters:
IOnDidFrameNavigate -> unit
Modifiers: inline |
Emitted when any frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.offDidFrameNavigate handler
Parameters:
Event -> string -> int -> string -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when any frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.offDidNavigate handler
Parameters:
IOnDidNavigate -> unit
Modifiers: inline |
Emitted when a main frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.offDidNavigate handler
Parameters:
Event -> string -> int -> string -> unit
Modifiers: inline |
Emitted when a main frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.offDidNavigateInPage handler
Parameters:
IOnDidNavigateInPage -> unit
Modifiers: inline |
Emitted when an in-page navigation happened in any frame.When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM hashchange event is triggered.
|
Full Usage:
this.offDidNavigateInPage handler
Parameters:
Event -> string -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when an in-page navigation happened in any frame.When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM hashchange event is triggered.
|
Full Usage:
this.offDidRedirectNavigation handler
Parameters:
IOnDidRedirectNavigation -> unit
Modifiers: inline |
Emitted after a server side redirect occurs during navigation. For example a 302 redirect.This event cannot be prevented, if you want to prevent redirects you should checkout out the will-redirect event above.
|
Full Usage:
this.offDidRedirectNavigation handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted after a server side redirect occurs during navigation. For example a 302 redirect.This event cannot be prevented, if you want to prevent redirects you should checkout out the will-redirect event above.
|
Full Usage:
this.offDidStartLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab started spinning.
|
Full Usage:
this.offDidStartNavigation handler
Parameters:
IOnDidStartNavigation -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating.
|
Full Usage:
this.offDidStartNavigation handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating.
|
Full Usage:
this.offDidStopLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab stopped spinning.
|
Full Usage:
this.offDomReady handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the document in the top-level frame is loaded.
|
Full Usage:
this.offEnterHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the window enters a full-screen state triggered by HTML API.
|
Full Usage:
this.offFocus handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the WebContents gains focus.Note that on macOS, having focus means the WebContents is the first responder of window, so switching focus between windows would not trigger the focus and blur events of WebContents, as the first responder of each window is not changed.The focus and blur events of WebContents should only be used to detect focus change between different WebContents and BrowserView in the same window.
|
Full Usage:
this.offFoundInPage handler
Parameters:
IOnFoundInPage -> unit
Modifiers: inline |
Emitted when a result is available for webContents.findInPage request.
|
|
|
Full Usage:
this.offFrameCreated handler
Parameters:
IOnFrameCreated -> unit
Modifiers: inline |
Emitted when the mainFrame, an
|
|
|
Full Usage:
this.offInputEvent handler
Parameters:
IOnInputEvent -> unit
Modifiers: inline |
Emitted when an input event is sent to the WebContents. See InputEvent for details.
|
Full Usage:
this.offInputEvent handler
Parameters:
Event -> InputEvent -> unit
Modifiers: inline |
Emitted when an input event is sent to the WebContents. See InputEvent for details.
|
Full Usage:
this.offIpcMessage handler
Parameters:
IOnIpcMessage -> unit
Modifiers: inline |
Emitted when the renderer process sends an asynchronous message via ipcRenderer.send().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.offIpcMessage handler
Parameters:
IpcMainEvent -> string -> obj[] -> unit
Modifiers: inline |
Emitted when the renderer process sends an asynchronous message via ipcRenderer.send().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.offIpcMessageSync handler
Parameters:
IOnIpcMessageSync -> unit
Modifiers: inline |
Emitted when the renderer process sends a synchronous message via ipcRenderer.sendSync().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.offIpcMessageSync handler
Parameters:
IpcMainEvent -> string -> obj[] -> unit
Modifiers: inline |
Emitted when the renderer process sends a synchronous message via ipcRenderer.sendSync().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.offLeaveHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the window leaves a full-screen state triggered by HTML API.
|
|
Emitted when webContents wants to do basic auth.The usage is the same with the login event of app.
|
Full Usage:
this.offLogin handler
Parameters:
Event -> AuthenticationResponseDetails -> AuthInfo -> Option<string> * Option<string> -> unit -> unit
Modifiers: inline |
Emitted when webContents wants to do basic auth.The usage is the same with the login event of app.
|
Full Usage:
this.offMediaPaused handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when media is paused or done playing.
|
Full Usage:
this.offMediaStartedPlaying handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when media starts playing.
|
Full Usage:
this.offPageFaviconUpdated handler
Parameters:
IOnPageFaviconUpdated -> unit
Modifiers: inline |
Emitted when page receives favicon urls.
|
Full Usage:
this.offPageFaviconUpdated handler
Parameters:
Event -> string[] -> unit
Modifiers: inline |
Emitted when page receives favicon urls.
|
Full Usage:
this.offPageTitleUpdated handler
Parameters:
IOnPageTitleUpdated -> unit
Modifiers: inline |
Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.
|
Full Usage:
this.offPageTitleUpdated handler
Parameters:
Event -> string -> bool -> unit
Modifiers: inline |
Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.
|
|
Emitted when a new frame is generated. Only the dirty area is passed in the buffer.When using shared texture (set webPreferences.offscreen.useSharedTexture to true) feature, you can pass the texture handle to external rendering pipeline without the overhead of copying data between CPU and GPU memory, with Chromium's hardware acceleration support. This feature is helpful for high-performance rendering scenarios.Only a limited number of textures can exist at the same time, so it's important that you call texture.release() as soon as you're done with the texture. By managing the texture lifecycle by yourself, you can safely pass the texture.textureInfo to other processes through IPC.More details can be found in the offscreen rendering tutorial. To learn about how to handle the texture in native code, refer to offscreen rendering's code documentation..
|
Full Usage:
this.offPaint handler
Parameters:
Details -> Rectangle -> NativeImage -> unit
Modifiers: inline |
Emitted when a new frame is generated. Only the dirty area is passed in the buffer.When using shared texture (set webPreferences.offscreen.useSharedTexture to true) feature, you can pass the texture handle to external rendering pipeline without the overhead of copying data between CPU and GPU memory, with Chromium's hardware acceleration support. This feature is helpful for high-performance rendering scenarios.Only a limited number of textures can exist at the same time, so it's important that you call texture.release() as soon as you're done with the texture. By managing the texture lifecycle by yourself, you can safely pass the texture.textureInfo to other processes through IPC.More details can be found in the offscreen rendering tutorial. To learn about how to handle the texture in native code, refer to offscreen rendering's code documentation..
|
Full Usage:
this.offPreferredSizeChanged handler
Parameters:
IOnPreferredSizeChanged -> unit
Modifiers: inline |
Emitted when the WebContents preferred size has changed.This event will only be emitted when enablePreferredSizeMode is set to true in webPreferences.
|
|
|
Full Usage:
this.offPreloadError handler
Parameters:
IOnPreloadError -> unit
Modifiers: inline |
Emitted when the preload script preloadPath throws an unhandled exception error.
|
|
|
Full Usage:
this.offRenderProcessGone handler
Parameters:
IOnRenderProcessGone -> unit
Modifiers: inline |
Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.
|
Full Usage:
this.offRenderProcessGone handler
Parameters:
Event -> RenderProcessGoneDetails -> unit
Modifiers: inline |
Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.
|
Full Usage:
this.offResponsive handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the unresponsive web page becomes responsive again.
|
Full Usage:
this.offSelectBluetoothDevice handler
Parameters:
IOnSelectBluetoothDevice -> unit
Modifiers: inline |
Emitted when a bluetooth device needs to be selected when a call to navigator.bluetooth.requestDevice is made. callback should be called with the deviceId of the device to be selected. Passing an empty string to callback will cancel the request.If no event listener is added for this event, all bluetooth requests will be cancelled.If event.preventDefault is not called when handling this event, the first available device will be automatically selected.Due to the nature of bluetooth, scanning for devices when navigator.bluetooth.requestDevice is called may take time and will cause select-bluetooth-device to fire multiple times until callback is called with either a device id or an empty string to cancel the request.
|
Full Usage:
this.offSelectBluetoothDevice handler
Parameters:
Event -> BluetoothDevice[] -> string -> unit -> unit
Modifiers: inline |
Emitted when a bluetooth device needs to be selected when a call to navigator.bluetooth.requestDevice is made. callback should be called with the deviceId of the device to be selected. Passing an empty string to callback will cancel the request.If no event listener is added for this event, all bluetooth requests will be cancelled.If event.preventDefault is not called when handling this event, the first available device will be automatically selected.Due to the nature of bluetooth, scanning for devices when navigator.bluetooth.requestDevice is called may take time and will cause select-bluetooth-device to fire multiple times until callback is called with either a device id or an empty string to cancel the request.
|
Full Usage:
this.offSelectClientCertificate handler
Parameters:
IOnSelectClientCertificate -> unit
Modifiers: inline |
Emitted when a client certificate is requested.The usage is the same with the select-client-certificate event of app.
|
Full Usage:
this.offSelectClientCertificate handler
Parameters:
Event -> URL -> Certificate[] -> Certificate -> unit -> unit
Modifiers: inline |
Emitted when a client certificate is requested.The usage is the same with the select-client-certificate event of app.
|
Full Usage:
this.offUnresponsive handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the web page becomes unresponsive.
|
Full Usage:
this.offUpdateTargetUrl handler
Parameters:
IOnUpdateTargetUrl -> unit
Modifiers: inline |
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
Full Usage:
this.offUpdateTargetUrl handler
Parameters:
Event -> string -> unit
Modifiers: inline |
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
Full Usage:
this.offWillAttachWebview handler
Parameters:
IOnWillAttachWebview -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.offWillAttachWebview handler
Parameters:
Event -> WebPreferences -> Record<string, string> -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.offWillFrameNavigate handler
Parameters:
Details -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation in any frame. It can happen when the window.location object is changed or a user clicks a link in the page.Unlike will-navigate, will-frame-navigate is fired when the main frame or any of its subframes attempts to navigate. When the navigation event comes from the main frame, isMainFrame will be true.This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back.It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.Calling event.preventDefault() will prevent the navigation.
|
Full Usage:
this.offWillNavigate handler
Parameters:
IOnWillNavigate -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation on the main frame. It can happen when the window.location object is changed or a user clicks a link in the page.This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back.It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.Calling event.preventDefault() will prevent the navigation.
|
Full Usage:
this.offWillNavigate handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation on the main frame. It can happen when the window.location object is changed or a user clicks a link in the page.This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back.It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.Calling event.preventDefault() will prevent the navigation.
|
|
Emitted when a beforeunload event handler is attempting to cancel a page unload.Calling event.preventDefault() will ignore the beforeunload event handler and allow the page to be unloaded.> [!NOTE] This will be emitted for BrowserViews but will not be respected - this is because we have chosen not to tie the BrowserView lifecycle to its owning BrowserWindow should one exist per the specification.
|
Full Usage:
this.offWillRedirect handler
Parameters:
IOnWillRedirect -> unit
Modifiers: inline |
Emitted when a server side redirect occurs during navigation. For example a 302 redirect.This event will be emitted after did-start-navigation and always before the did-redirect-navigation event for the same navigation.Calling event.preventDefault() will prevent the navigation (not just the redirect).
|
Full Usage:
this.offWillRedirect handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a server side redirect occurs during navigation. For example a 302 redirect.This event will be emitted after did-start-navigation and always before the did-redirect-navigation event for the same navigation.Calling event.preventDefault() will prevent the navigation (not just the redirect).
|
Full Usage:
this.offZoomChanged handler
Parameters:
IOnZoomChanged -> unit
Modifiers: inline |
Emitted when the user is requesting to change the zoom level using the mouse wheel.
|
Full Usage:
this.offZoomChanged handler
Parameters:
Event -> ZoomDirection -> unit
Modifiers: inline |
Emitted when the user is requesting to change the zoom level using the mouse wheel.
|
Full Usage:
this.onAudioStateChanged handler
Parameters:
EventInfo -> unit
Modifiers: inline |
Emitted when media becomes audible or inaudible.
|
Full Usage:
this.onBeforeInputEvent handler
Parameters:
IOnBeforeInputEvent -> unit
Modifiers: inline |
Emitted before dispatching the keydown and keyup events in the page. Calling event.preventDefault will prevent the page keydown/keyup events and the menu shortcuts.To only prevent the menu shortcuts, use setIgnoreMenuShortcuts:
|
|
|
Full Usage:
this.onBeforeMouseEvent handler
Parameters:
IOnBeforeMouseEvent -> unit
Modifiers: inline |
Emitted before dispatching mouse events in the page.Calling event.preventDefault will prevent the page mouse events.
|
Full Usage:
this.onBeforeMouseEvent handler
Parameters:
Event -> MouseInputEvent -> unit
Modifiers: inline |
Emitted before dispatching mouse events in the page.Calling event.preventDefault will prevent the page mouse events.
|
Full Usage:
this.onBlur handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the WebContents loses focus.
|
Full Usage:
this.onCertificateError handler
Parameters:
IOnCertificateError -> unit
Modifiers: inline |
Emitted when failed to verify the certificate for url.The usage is the same with the certificate-error event of app.
|
Full Usage:
this.onCertificateError handler
Parameters:
Event -> string -> string -> Certificate -> bool -> unit -> bool -> unit
Modifiers: inline |
Emitted when failed to verify the certificate for url.The usage is the same with the certificate-error event of app.
|
Full Usage:
this.onConsoleMessage handler
Parameters:
IOnConsoleMessage -> unit
Modifiers: inline |
Emitted when the associated window logs a console message.
|
Full Usage:
this.onConsoleMessage handler
Parameters:
Details -> int -> string -> int -> string -> unit
Modifiers: inline |
Emitted when the associated window logs a console message.
|
Full Usage:
this.onContentBoundsUpdated handler
Parameters:
IOnContentBoundsUpdated -> unit
Modifiers: inline |
Emitted when the page calls window.moveTo, window.resizeTo or related APIs.By default, this will move the window. To prevent that behavior, call event.preventDefault().
|
|
|
Full Usage:
this.onContextMenu handler
Parameters:
IOnContextMenu -> unit
Modifiers: inline |
Emitted when there is a new context menu that needs to be handled.
|
|
|
Full Usage:
this.onCursorChanged handler
Parameters:
IOnCursorChanged -> unit
Modifiers: inline |
Emitted when the cursor's type changes. The type parameter can be pointer, crosshair, hand, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, nwse-resize, col-resize, row-resize, m-panning, m-panning-vertical, m-panning-horizontal, e-panning, n-panning, ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, not-allowed, zoom-in, zoom-out, grab, grabbing, custom, null, drag-drop-none, drag-drop-move, drag-drop-copy, drag-drop-link, ns-no-resize, ew-no-resize, nesw-no-resize, nwse-no-resize, or default.If the type parameter is custom, the image parameter will hold the custom cursor image in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.
|
Full Usage:
this.onCursorChanged handler
Parameters:
Event -> string -> NativeImage -> float -> Size -> Point -> unit
Modifiers: inline |
Emitted when the cursor's type changes. The type parameter can be pointer, crosshair, hand, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, nwse-resize, col-resize, row-resize, m-panning, m-panning-vertical, m-panning-horizontal, e-panning, n-panning, ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, not-allowed, zoom-in, zoom-out, grab, grabbing, custom, null, drag-drop-none, drag-drop-move, drag-drop-copy, drag-drop-link, ns-no-resize, ew-no-resize, nesw-no-resize, nwse-no-resize, or default.If the type parameter is custom, the image parameter will hold the custom cursor image in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.
|
Full Usage:
this.onDestroyed handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when webContents is destroyed.
|
Full Usage:
this.onDevtoolsClosed handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is closed.
|
Full Usage:
this.onDevtoolsFocused handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is focused / opened.
|
Full Usage:
this.onDevtoolsOpenUrl handler
Parameters:
IOnDevtoolsOpenUrl -> unit
Modifiers: inline |
Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu.
|
Full Usage:
this.onDevtoolsOpenUrl handler
Parameters:
Event -> string -> unit
Modifiers: inline |
Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu.
|
Full Usage:
this.onDevtoolsOpened handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is opened.
|
Full Usage:
this.onDevtoolsReloadPage handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the devtools window instructs the webContents to reload
|
Full Usage:
this.onDevtoolsSearchQuery handler
Parameters:
IOnDevtoolsSearchQuery -> unit
Modifiers: inline |
Emitted when 'Search' is selected for text in its context menu.
|
Full Usage:
this.onDevtoolsSearchQuery handler
Parameters:
Event -> string -> unit
Modifiers: inline |
Emitted when 'Search' is selected for text in its context menu.
|
Full Usage:
this.onDidAttachWebview handler
Parameters:
IOnDidAttachWebview -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.onDidAttachWebview handler
Parameters:
Event -> WebContents -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.onDidChangeThemeColor handler
Parameters:
IOnDidChangeThemeColor -> unit
Modifiers: inline |
Emitted when a page's theme color changes. This is usually due to encountering a meta tag:
|
|
|
Full Usage:
this.onDidCreateWindow handler
Parameters:
IOnDidCreateWindow -> unit
Modifiers: inline |
Emitted after successful creation of a window via window.open in the renderer. Not emitted if the creation of the window is canceled from webContents.setWindowOpenHandler.See window.open() for more details and how to use this in conjunction with webContents.setWindowOpenHandler.
|
Full Usage:
this.onDidCreateWindow handler
Parameters:
BrowserWindow -> Details -> unit
Modifiers: inline |
Emitted after successful creation of a window via window.open in the renderer. Not emitted if the creation of the window is canceled from webContents.setWindowOpenHandler.See window.open() for more details and how to use this in conjunction with webContents.setWindowOpenHandler.
|
Full Usage:
this.onDidFailLoad handler
Parameters:
IOnDidFailLoad -> unit
Modifiers: inline |
This event is like did-finish-load but emitted when the load failed. The full list of error codes and their meaning is available here.
|
Full Usage:
this.onDidFailLoad handler
Parameters:
Event -> int -> string -> string -> bool -> int -> int -> unit
Modifiers: inline |
This event is like did-finish-load but emitted when the load failed. The full list of error codes and their meaning is available here.
|
Full Usage:
this.onDidFailProvisionalLoad handler
Parameters:
IOnDidFailProvisionalLoad -> unit
Modifiers: inline |
This event is like did-fail-load but emitted when the load was cancelled (e.g. window.stop() was invoked).
|
Full Usage:
this.onDidFailProvisionalLoad handler
Parameters:
Event -> int -> string -> string -> bool -> int -> int -> unit
Modifiers: inline |
This event is like did-fail-load but emitted when the load was cancelled (e.g. window.stop() was invoked).
|
Full Usage:
this.onDidFinishLoad handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the navigation is done, i.e. the spinner of the tab has stopped spinning, and the onload event was dispatched.
|
Full Usage:
this.onDidFrameFinishLoad handler
Parameters:
IOnDidFrameFinishLoad -> unit
Modifiers: inline |
Emitted when a frame has done navigation.
|
Full Usage:
this.onDidFrameFinishLoad handler
Parameters:
Event -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a frame has done navigation.
|
Full Usage:
this.onDidFrameNavigate handler
Parameters:
IOnDidFrameNavigate -> unit
Modifiers: inline |
Emitted when any frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.onDidFrameNavigate handler
Parameters:
Event -> string -> int -> string -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when any frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.onDidNavigate handler
Parameters:
IOnDidNavigate -> unit
Modifiers: inline |
Emitted when a main frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.onDidNavigate handler
Parameters:
Event -> string -> int -> string -> unit
Modifiers: inline |
Emitted when a main frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.onDidNavigateInPage handler
Parameters:
IOnDidNavigateInPage -> unit
Modifiers: inline |
Emitted when an in-page navigation happened in any frame.When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM hashchange event is triggered.
|
Full Usage:
this.onDidNavigateInPage handler
Parameters:
Event -> string -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when an in-page navigation happened in any frame.When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM hashchange event is triggered.
|
Full Usage:
this.onDidRedirectNavigation handler
Parameters:
IOnDidRedirectNavigation -> unit
Modifiers: inline |
Emitted after a server side redirect occurs during navigation. For example a 302 redirect.This event cannot be prevented, if you want to prevent redirects you should checkout out the will-redirect event above.
|
Full Usage:
this.onDidRedirectNavigation handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted after a server side redirect occurs during navigation. For example a 302 redirect.This event cannot be prevented, if you want to prevent redirects you should checkout out the will-redirect event above.
|
Full Usage:
this.onDidStartLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab started spinning.
|
Full Usage:
this.onDidStartNavigation handler
Parameters:
IOnDidStartNavigation -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating.
|
Full Usage:
this.onDidStartNavigation handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating.
|
Full Usage:
this.onDidStopLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab stopped spinning.
|
Full Usage:
this.onDomReady handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the document in the top-level frame is loaded.
|
Full Usage:
this.onEnterHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the window enters a full-screen state triggered by HTML API.
|
Full Usage:
this.onFocus handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the WebContents gains focus.Note that on macOS, having focus means the WebContents is the first responder of window, so switching focus between windows would not trigger the focus and blur events of WebContents, as the first responder of each window is not changed.The focus and blur events of WebContents should only be used to detect focus change between different WebContents and BrowserView in the same window.
|
Full Usage:
this.onFoundInPage handler
Parameters:
IOnFoundInPage -> unit
Modifiers: inline |
Emitted when a result is available for webContents.findInPage request.
|
|
|
Full Usage:
this.onFrameCreated handler
Parameters:
IOnFrameCreated -> unit
Modifiers: inline |
Emitted when the mainFrame, an
|
|
|
|
Emitted when an input event is sent to the WebContents. See InputEvent for details.
|
Full Usage:
this.onInputEvent handler
Parameters:
Event -> InputEvent -> unit
Modifiers: inline |
Emitted when an input event is sent to the WebContents. See InputEvent for details.
|
|
Emitted when the renderer process sends an asynchronous message via ipcRenderer.send().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.onIpcMessage handler
Parameters:
IpcMainEvent -> string -> obj[] -> unit
Modifiers: inline |
Emitted when the renderer process sends an asynchronous message via ipcRenderer.send().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.onIpcMessageSync handler
Parameters:
IOnIpcMessageSync -> unit
Modifiers: inline |
Emitted when the renderer process sends a synchronous message via ipcRenderer.sendSync().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.onIpcMessageSync handler
Parameters:
IpcMainEvent -> string -> obj[] -> unit
Modifiers: inline |
Emitted when the renderer process sends a synchronous message via ipcRenderer.sendSync().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.onLeaveHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the window leaves a full-screen state triggered by HTML API.
|
|
Emitted when webContents wants to do basic auth.The usage is the same with the login event of app.
|
Full Usage:
this.onLogin handler
Parameters:
Event -> AuthenticationResponseDetails -> AuthInfo -> Option<string> * Option<string> -> unit -> unit
Modifiers: inline |
Emitted when webContents wants to do basic auth.The usage is the same with the login event of app.
|
Full Usage:
this.onMediaPaused handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when media is paused or done playing.
|
Full Usage:
this.onMediaStartedPlaying handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when media starts playing.
|
Full Usage:
this.onPageFaviconUpdated handler
Parameters:
IOnPageFaviconUpdated -> unit
Modifiers: inline |
Emitted when page receives favicon urls.
|
Full Usage:
this.onPageFaviconUpdated handler
Parameters:
Event -> string[] -> unit
Modifiers: inline |
Emitted when page receives favicon urls.
|
Full Usage:
this.onPageTitleUpdated handler
Parameters:
IOnPageTitleUpdated -> unit
Modifiers: inline |
Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.
|
Full Usage:
this.onPageTitleUpdated handler
Parameters:
Event -> string -> bool -> unit
Modifiers: inline |
Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.
|
|
Emitted when a new frame is generated. Only the dirty area is passed in the buffer.When using shared texture (set webPreferences.offscreen.useSharedTexture to true) feature, you can pass the texture handle to external rendering pipeline without the overhead of copying data between CPU and GPU memory, with Chromium's hardware acceleration support. This feature is helpful for high-performance rendering scenarios.Only a limited number of textures can exist at the same time, so it's important that you call texture.release() as soon as you're done with the texture. By managing the texture lifecycle by yourself, you can safely pass the texture.textureInfo to other processes through IPC.More details can be found in the offscreen rendering tutorial. To learn about how to handle the texture in native code, refer to offscreen rendering's code documentation..
|
Full Usage:
this.onPaint handler
Parameters:
Details -> Rectangle -> NativeImage -> unit
Modifiers: inline |
Emitted when a new frame is generated. Only the dirty area is passed in the buffer.When using shared texture (set webPreferences.offscreen.useSharedTexture to true) feature, you can pass the texture handle to external rendering pipeline without the overhead of copying data between CPU and GPU memory, with Chromium's hardware acceleration support. This feature is helpful for high-performance rendering scenarios.Only a limited number of textures can exist at the same time, so it's important that you call texture.release() as soon as you're done with the texture. By managing the texture lifecycle by yourself, you can safely pass the texture.textureInfo to other processes through IPC.More details can be found in the offscreen rendering tutorial. To learn about how to handle the texture in native code, refer to offscreen rendering's code documentation..
|
Full Usage:
this.onPreferredSizeChanged handler
Parameters:
IOnPreferredSizeChanged -> unit
Modifiers: inline |
Emitted when the WebContents preferred size has changed.This event will only be emitted when enablePreferredSizeMode is set to true in webPreferences.
|
|
|
Full Usage:
this.onPreloadError handler
Parameters:
IOnPreloadError -> unit
Modifiers: inline |
Emitted when the preload script preloadPath throws an unhandled exception error.
|
|
|
Full Usage:
this.onRenderProcessGone handler
Parameters:
IOnRenderProcessGone -> unit
Modifiers: inline |
Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.
|
Full Usage:
this.onRenderProcessGone handler
Parameters:
Event -> RenderProcessGoneDetails -> unit
Modifiers: inline |
Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.
|
Full Usage:
this.onResponsive handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the unresponsive web page becomes responsive again.
|
Full Usage:
this.onSelectBluetoothDevice handler
Parameters:
IOnSelectBluetoothDevice -> unit
Modifiers: inline |
Emitted when a bluetooth device needs to be selected when a call to navigator.bluetooth.requestDevice is made. callback should be called with the deviceId of the device to be selected. Passing an empty string to callback will cancel the request.If no event listener is added for this event, all bluetooth requests will be cancelled.If event.preventDefault is not called when handling this event, the first available device will be automatically selected.Due to the nature of bluetooth, scanning for devices when navigator.bluetooth.requestDevice is called may take time and will cause select-bluetooth-device to fire multiple times until callback is called with either a device id or an empty string to cancel the request.
|
Full Usage:
this.onSelectBluetoothDevice handler
Parameters:
Event -> BluetoothDevice[] -> string -> unit -> unit
Modifiers: inline |
Emitted when a bluetooth device needs to be selected when a call to navigator.bluetooth.requestDevice is made. callback should be called with the deviceId of the device to be selected. Passing an empty string to callback will cancel the request.If no event listener is added for this event, all bluetooth requests will be cancelled.If event.preventDefault is not called when handling this event, the first available device will be automatically selected.Due to the nature of bluetooth, scanning for devices when navigator.bluetooth.requestDevice is called may take time and will cause select-bluetooth-device to fire multiple times until callback is called with either a device id or an empty string to cancel the request.
|
Full Usage:
this.onSelectClientCertificate handler
Parameters:
IOnSelectClientCertificate -> unit
Modifiers: inline |
Emitted when a client certificate is requested.The usage is the same with the select-client-certificate event of app.
|
Full Usage:
this.onSelectClientCertificate handler
Parameters:
Event -> URL -> Certificate[] -> Certificate -> unit -> unit
Modifiers: inline |
Emitted when a client certificate is requested.The usage is the same with the select-client-certificate event of app.
|
Full Usage:
this.onUnresponsive handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the web page becomes unresponsive.
|
Full Usage:
this.onUpdateTargetUrl handler
Parameters:
IOnUpdateTargetUrl -> unit
Modifiers: inline |
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
Full Usage:
this.onUpdateTargetUrl handler
Parameters:
Event -> string -> unit
Modifiers: inline |
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
Full Usage:
this.onWillAttachWebview handler
Parameters:
IOnWillAttachWebview -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.onWillAttachWebview handler
Parameters:
Event -> WebPreferences -> Record<string, string> -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.onWillFrameNavigate handler
Parameters:
Details -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation in any frame. It can happen when the window.location object is changed or a user clicks a link in the page.Unlike will-navigate, will-frame-navigate is fired when the main frame or any of its subframes attempts to navigate. When the navigation event comes from the main frame, isMainFrame will be true.This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back.It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.Calling event.preventDefault() will prevent the navigation.
|
Full Usage:
this.onWillNavigate handler
Parameters:
IOnWillNavigate -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation on the main frame. It can happen when the window.location object is changed or a user clicks a link in the page.This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back.It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.Calling event.preventDefault() will prevent the navigation.
|
Full Usage:
this.onWillNavigate handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation on the main frame. It can happen when the window.location object is changed or a user clicks a link in the page.This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back.It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.Calling event.preventDefault() will prevent the navigation.
|
|
Emitted when a beforeunload event handler is attempting to cancel a page unload.Calling event.preventDefault() will ignore the beforeunload event handler and allow the page to be unloaded.> [!NOTE] This will be emitted for BrowserViews but will not be respected - this is because we have chosen not to tie the BrowserView lifecycle to its owning BrowserWindow should one exist per the specification.
|
Full Usage:
this.onWillRedirect handler
Parameters:
IOnWillRedirect -> unit
Modifiers: inline |
Emitted when a server side redirect occurs during navigation. For example a 302 redirect.This event will be emitted after did-start-navigation and always before the did-redirect-navigation event for the same navigation.Calling event.preventDefault() will prevent the navigation (not just the redirect).
|
Full Usage:
this.onWillRedirect handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a server side redirect occurs during navigation. For example a 302 redirect.This event will be emitted after did-start-navigation and always before the did-redirect-navigation event for the same navigation.Calling event.preventDefault() will prevent the navigation (not just the redirect).
|
Full Usage:
this.onZoomChanged handler
Parameters:
IOnZoomChanged -> unit
Modifiers: inline |
Emitted when the user is requesting to change the zoom level using the mouse wheel.
|
Full Usage:
this.onZoomChanged handler
Parameters:
Event -> ZoomDirection -> unit
Modifiers: inline |
Emitted when the user is requesting to change the zoom level using the mouse wheel.
|
Full Usage:
this.onceAudioStateChanged handler
Parameters:
EventInfo -> unit
Modifiers: inline |
Emitted when media becomes audible or inaudible.
|
Full Usage:
this.onceBeforeInputEvent handler
Parameters:
IOnBeforeInputEvent -> unit
Modifiers: inline |
Emitted before dispatching the keydown and keyup events in the page. Calling event.preventDefault will prevent the page keydown/keyup events and the menu shortcuts.To only prevent the menu shortcuts, use setIgnoreMenuShortcuts:
|
|
|
Full Usage:
this.onceBeforeMouseEvent handler
Parameters:
IOnBeforeMouseEvent -> unit
Modifiers: inline |
Emitted before dispatching mouse events in the page.Calling event.preventDefault will prevent the page mouse events.
|
Full Usage:
this.onceBeforeMouseEvent handler
Parameters:
Event -> MouseInputEvent -> unit
Modifiers: inline |
Emitted before dispatching mouse events in the page.Calling event.preventDefault will prevent the page mouse events.
|
Full Usage:
this.onceBlur handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the WebContents loses focus.
|
Full Usage:
this.onceCertificateError handler
Parameters:
IOnCertificateError -> unit
Modifiers: inline |
Emitted when failed to verify the certificate for url.The usage is the same with the certificate-error event of app.
|
Full Usage:
this.onceCertificateError handler
Parameters:
Event -> string -> string -> Certificate -> bool -> unit -> bool -> unit
Modifiers: inline |
Emitted when failed to verify the certificate for url.The usage is the same with the certificate-error event of app.
|
Full Usage:
this.onceConsoleMessage handler
Parameters:
IOnConsoleMessage -> unit
Modifiers: inline |
Emitted when the associated window logs a console message.
|
Full Usage:
this.onceConsoleMessage handler
Parameters:
Details -> int -> string -> int -> string -> unit
Modifiers: inline |
Emitted when the associated window logs a console message.
|
Full Usage:
this.onceContentBoundsUpdated handler
Parameters:
IOnContentBoundsUpdated -> unit
Modifiers: inline |
Emitted when the page calls window.moveTo, window.resizeTo or related APIs.By default, this will move the window. To prevent that behavior, call event.preventDefault().
|
|
|
Full Usage:
this.onceContextMenu handler
Parameters:
IOnContextMenu -> unit
Modifiers: inline |
Emitted when there is a new context menu that needs to be handled.
|
|
|
Full Usage:
this.onceCursorChanged handler
Parameters:
IOnCursorChanged -> unit
Modifiers: inline |
Emitted when the cursor's type changes. The type parameter can be pointer, crosshair, hand, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, nwse-resize, col-resize, row-resize, m-panning, m-panning-vertical, m-panning-horizontal, e-panning, n-panning, ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, not-allowed, zoom-in, zoom-out, grab, grabbing, custom, null, drag-drop-none, drag-drop-move, drag-drop-copy, drag-drop-link, ns-no-resize, ew-no-resize, nesw-no-resize, nwse-no-resize, or default.If the type parameter is custom, the image parameter will hold the custom cursor image in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.
|
Full Usage:
this.onceCursorChanged handler
Parameters:
Event -> string -> NativeImage -> float -> Size -> Point -> unit
Modifiers: inline |
Emitted when the cursor's type changes. The type parameter can be pointer, crosshair, hand, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, nwse-resize, col-resize, row-resize, m-panning, m-panning-vertical, m-panning-horizontal, e-panning, n-panning, ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, not-allowed, zoom-in, zoom-out, grab, grabbing, custom, null, drag-drop-none, drag-drop-move, drag-drop-copy, drag-drop-link, ns-no-resize, ew-no-resize, nesw-no-resize, nwse-no-resize, or default.If the type parameter is custom, the image parameter will hold the custom cursor image in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.
|
Full Usage:
this.onceDestroyed handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when webContents is destroyed.
|
Full Usage:
this.onceDevtoolsClosed handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is closed.
|
Full Usage:
this.onceDevtoolsFocused handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is focused / opened.
|
Full Usage:
this.onceDevtoolsOpenUrl handler
Parameters:
IOnDevtoolsOpenUrl -> unit
Modifiers: inline |
Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu.
|
Full Usage:
this.onceDevtoolsOpenUrl handler
Parameters:
Event -> string -> unit
Modifiers: inline |
Emitted when a link is clicked in DevTools or 'Open in new tab' is selected for a link in its context menu.
|
Full Usage:
this.onceDevtoolsOpened handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is opened.
|
Full Usage:
this.onceDevtoolsReloadPage handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the devtools window instructs the webContents to reload
|
Full Usage:
this.onceDevtoolsSearchQuery handler
Parameters:
IOnDevtoolsSearchQuery -> unit
Modifiers: inline |
Emitted when 'Search' is selected for text in its context menu.
|
Full Usage:
this.onceDevtoolsSearchQuery handler
Parameters:
Event -> string -> unit
Modifiers: inline |
Emitted when 'Search' is selected for text in its context menu.
|
Full Usage:
this.onceDidAttachWebview handler
Parameters:
IOnDidAttachWebview -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.onceDidAttachWebview handler
Parameters:
Event -> WebContents -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.onceDidChangeThemeColor handler
Parameters:
IOnDidChangeThemeColor -> unit
Modifiers: inline |
Emitted when a page's theme color changes. This is usually due to encountering a meta tag:
|
|
|
Full Usage:
this.onceDidCreateWindow handler
Parameters:
IOnDidCreateWindow -> unit
Modifiers: inline |
Emitted after successful creation of a window via window.open in the renderer. Not emitted if the creation of the window is canceled from webContents.setWindowOpenHandler.See window.open() for more details and how to use this in conjunction with webContents.setWindowOpenHandler.
|
Full Usage:
this.onceDidCreateWindow handler
Parameters:
BrowserWindow -> Details -> unit
Modifiers: inline |
Emitted after successful creation of a window via window.open in the renderer. Not emitted if the creation of the window is canceled from webContents.setWindowOpenHandler.See window.open() for more details and how to use this in conjunction with webContents.setWindowOpenHandler.
|
Full Usage:
this.onceDidFailLoad handler
Parameters:
IOnDidFailLoad -> unit
Modifiers: inline |
This event is like did-finish-load but emitted when the load failed. The full list of error codes and their meaning is available here.
|
Full Usage:
this.onceDidFailLoad handler
Parameters:
Event -> int -> string -> string -> bool -> int -> int -> unit
Modifiers: inline |
This event is like did-finish-load but emitted when the load failed. The full list of error codes and their meaning is available here.
|
Full Usage:
this.onceDidFailProvisionalLoad handler
Parameters:
IOnDidFailProvisionalLoad -> unit
Modifiers: inline |
This event is like did-fail-load but emitted when the load was cancelled (e.g. window.stop() was invoked).
|
Full Usage:
this.onceDidFailProvisionalLoad handler
Parameters:
Event -> int -> string -> string -> bool -> int -> int -> unit
Modifiers: inline |
This event is like did-fail-load but emitted when the load was cancelled (e.g. window.stop() was invoked).
|
Full Usage:
this.onceDidFinishLoad handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the navigation is done, i.e. the spinner of the tab has stopped spinning, and the onload event was dispatched.
|
Full Usage:
this.onceDidFrameFinishLoad handler
Parameters:
IOnDidFrameFinishLoad -> unit
Modifiers: inline |
Emitted when a frame has done navigation.
|
Full Usage:
this.onceDidFrameFinishLoad handler
Parameters:
Event -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a frame has done navigation.
|
Full Usage:
this.onceDidFrameNavigate handler
Parameters:
IOnDidFrameNavigate -> unit
Modifiers: inline |
Emitted when any frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.onceDidFrameNavigate handler
Parameters:
Event -> string -> int -> string -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when any frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.onceDidNavigate handler
Parameters:
IOnDidNavigate -> unit
Modifiers: inline |
Emitted when a main frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.onceDidNavigate handler
Parameters:
Event -> string -> int -> string -> unit
Modifiers: inline |
Emitted when a main frame navigation is done.This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
|
Full Usage:
this.onceDidNavigateInPage handler
Parameters:
IOnDidNavigateInPage -> unit
Modifiers: inline |
Emitted when an in-page navigation happened in any frame.When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM hashchange event is triggered.
|
Full Usage:
this.onceDidNavigateInPage handler
Parameters:
Event -> string -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when an in-page navigation happened in any frame.When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM hashchange event is triggered.
|
Full Usage:
this.onceDidRedirectNavigation handler
Parameters:
IOnDidRedirectNavigation -> unit
Modifiers: inline |
Emitted after a server side redirect occurs during navigation. For example a 302 redirect.This event cannot be prevented, if you want to prevent redirects you should checkout out the will-redirect event above.
|
Full Usage:
this.onceDidRedirectNavigation handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted after a server side redirect occurs during navigation. For example a 302 redirect.This event cannot be prevented, if you want to prevent redirects you should checkout out the will-redirect event above.
|
Full Usage:
this.onceDidStartLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab started spinning.
|
Full Usage:
this.onceDidStartNavigation handler
Parameters:
IOnDidStartNavigation -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating.
|
Full Usage:
this.onceDidStartNavigation handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating.
|
Full Usage:
this.onceDidStopLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab stopped spinning.
|
Full Usage:
this.onceDomReady handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the document in the top-level frame is loaded.
|
Full Usage:
this.onceEnterHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the window enters a full-screen state triggered by HTML API.
|
Full Usage:
this.onceFocus handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the WebContents gains focus.Note that on macOS, having focus means the WebContents is the first responder of window, so switching focus between windows would not trigger the focus and blur events of WebContents, as the first responder of each window is not changed.The focus and blur events of WebContents should only be used to detect focus change between different WebContents and BrowserView in the same window.
|
Full Usage:
this.onceFoundInPage handler
Parameters:
IOnFoundInPage -> unit
Modifiers: inline |
Emitted when a result is available for webContents.findInPage request.
|
|
|
Full Usage:
this.onceFrameCreated handler
Parameters:
IOnFrameCreated -> unit
Modifiers: inline |
Emitted when the mainFrame, an
|
|
|
Full Usage:
this.onceInputEvent handler
Parameters:
IOnInputEvent -> unit
Modifiers: inline |
Emitted when an input event is sent to the WebContents. See InputEvent for details.
|
Full Usage:
this.onceInputEvent handler
Parameters:
Event -> InputEvent -> unit
Modifiers: inline |
Emitted when an input event is sent to the WebContents. See InputEvent for details.
|
Full Usage:
this.onceIpcMessage handler
Parameters:
IOnIpcMessage -> unit
Modifiers: inline |
Emitted when the renderer process sends an asynchronous message via ipcRenderer.send().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.onceIpcMessage handler
Parameters:
IpcMainEvent -> string -> obj[] -> unit
Modifiers: inline |
Emitted when the renderer process sends an asynchronous message via ipcRenderer.send().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.onceIpcMessageSync handler
Parameters:
IOnIpcMessageSync -> unit
Modifiers: inline |
Emitted when the renderer process sends a synchronous message via ipcRenderer.sendSync().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.onceIpcMessageSync handler
Parameters:
IpcMainEvent -> string -> obj[] -> unit
Modifiers: inline |
Emitted when the renderer process sends a synchronous message via ipcRenderer.sendSync().See also webContents.ipc, which provides an IpcMain-like interface for responding to IPC messages specifically from this WebContents.
|
Full Usage:
this.onceLeaveHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the window leaves a full-screen state triggered by HTML API.
|
|
Emitted when webContents wants to do basic auth.The usage is the same with the login event of app.
|
Full Usage:
this.onceLogin handler
Parameters:
Event -> AuthenticationResponseDetails -> AuthInfo -> Option<string> * Option<string> -> unit -> unit
Modifiers: inline |
Emitted when webContents wants to do basic auth.The usage is the same with the login event of app.
|
Full Usage:
this.onceMediaPaused handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when media is paused or done playing.
|
Full Usage:
this.onceMediaStartedPlaying handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when media starts playing.
|
Full Usage:
this.oncePageFaviconUpdated handler
Parameters:
IOnPageFaviconUpdated -> unit
Modifiers: inline |
Emitted when page receives favicon urls.
|
Full Usage:
this.oncePageFaviconUpdated handler
Parameters:
Event -> string[] -> unit
Modifiers: inline |
Emitted when page receives favicon urls.
|
Full Usage:
this.oncePageTitleUpdated handler
Parameters:
IOnPageTitleUpdated -> unit
Modifiers: inline |
Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.
|
Full Usage:
this.oncePageTitleUpdated handler
Parameters:
Event -> string -> bool -> unit
Modifiers: inline |
Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.
|
|
Emitted when a new frame is generated. Only the dirty area is passed in the buffer.When using shared texture (set webPreferences.offscreen.useSharedTexture to true) feature, you can pass the texture handle to external rendering pipeline without the overhead of copying data between CPU and GPU memory, with Chromium's hardware acceleration support. This feature is helpful for high-performance rendering scenarios.Only a limited number of textures can exist at the same time, so it's important that you call texture.release() as soon as you're done with the texture. By managing the texture lifecycle by yourself, you can safely pass the texture.textureInfo to other processes through IPC.More details can be found in the offscreen rendering tutorial. To learn about how to handle the texture in native code, refer to offscreen rendering's code documentation..
|
Full Usage:
this.oncePaint handler
Parameters:
Details -> Rectangle -> NativeImage -> unit
Modifiers: inline |
Emitted when a new frame is generated. Only the dirty area is passed in the buffer.When using shared texture (set webPreferences.offscreen.useSharedTexture to true) feature, you can pass the texture handle to external rendering pipeline without the overhead of copying data between CPU and GPU memory, with Chromium's hardware acceleration support. This feature is helpful for high-performance rendering scenarios.Only a limited number of textures can exist at the same time, so it's important that you call texture.release() as soon as you're done with the texture. By managing the texture lifecycle by yourself, you can safely pass the texture.textureInfo to other processes through IPC.More details can be found in the offscreen rendering tutorial. To learn about how to handle the texture in native code, refer to offscreen rendering's code documentation..
|
Full Usage:
this.oncePreferredSizeChanged handler
Parameters:
IOnPreferredSizeChanged -> unit
Modifiers: inline |
Emitted when the WebContents preferred size has changed.This event will only be emitted when enablePreferredSizeMode is set to true in webPreferences.
|
|
|
Full Usage:
this.oncePreloadError handler
Parameters:
IOnPreloadError -> unit
Modifiers: inline |
Emitted when the preload script preloadPath throws an unhandled exception error.
|
|
|
Full Usage:
this.onceRenderProcessGone handler
Parameters:
IOnRenderProcessGone -> unit
Modifiers: inline |
Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.
|
Full Usage:
this.onceRenderProcessGone handler
Parameters:
Event -> RenderProcessGoneDetails -> unit
Modifiers: inline |
Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.
|
Full Usage:
this.onceResponsive handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the unresponsive web page becomes responsive again.
|
Full Usage:
this.onceSelectBluetoothDevice handler
Parameters:
IOnSelectBluetoothDevice -> unit
Modifiers: inline |
Emitted when a bluetooth device needs to be selected when a call to navigator.bluetooth.requestDevice is made. callback should be called with the deviceId of the device to be selected. Passing an empty string to callback will cancel the request.If no event listener is added for this event, all bluetooth requests will be cancelled.If event.preventDefault is not called when handling this event, the first available device will be automatically selected.Due to the nature of bluetooth, scanning for devices when navigator.bluetooth.requestDevice is called may take time and will cause select-bluetooth-device to fire multiple times until callback is called with either a device id or an empty string to cancel the request.
|
Full Usage:
this.onceSelectBluetoothDevice handler
Parameters:
Event -> BluetoothDevice[] -> string -> unit -> unit
Modifiers: inline |
Emitted when a bluetooth device needs to be selected when a call to navigator.bluetooth.requestDevice is made. callback should be called with the deviceId of the device to be selected. Passing an empty string to callback will cancel the request.If no event listener is added for this event, all bluetooth requests will be cancelled.If event.preventDefault is not called when handling this event, the first available device will be automatically selected.Due to the nature of bluetooth, scanning for devices when navigator.bluetooth.requestDevice is called may take time and will cause select-bluetooth-device to fire multiple times until callback is called with either a device id or an empty string to cancel the request.
|
Full Usage:
this.onceSelectClientCertificate handler
Parameters:
IOnSelectClientCertificate -> unit
Modifiers: inline |
Emitted when a client certificate is requested.The usage is the same with the select-client-certificate event of app.
|
Full Usage:
this.onceSelectClientCertificate handler
Parameters:
Event -> URL -> Certificate[] -> Certificate -> unit -> unit
Modifiers: inline |
Emitted when a client certificate is requested.The usage is the same with the select-client-certificate event of app.
|
Full Usage:
this.onceUnresponsive handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when the web page becomes unresponsive.
|
Full Usage:
this.onceUpdateTargetUrl handler
Parameters:
IOnUpdateTargetUrl -> unit
Modifiers: inline |
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
Full Usage:
this.onceUpdateTargetUrl handler
Parameters:
Event -> string -> unit
Modifiers: inline |
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
Full Usage:
this.onceWillAttachWebview handler
Parameters:
IOnWillAttachWebview -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.onceWillAttachWebview handler
Parameters:
Event -> WebPreferences -> Record<string, string> -> unit
Modifiers: inline |
Emitted when a
|
Full Usage:
this.onceWillFrameNavigate handler
Parameters:
Details -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation in any frame. It can happen when the window.location object is changed or a user clicks a link in the page.Unlike will-navigate, will-frame-navigate is fired when the main frame or any of its subframes attempts to navigate. When the navigation event comes from the main frame, isMainFrame will be true.This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back.It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.Calling event.preventDefault() will prevent the navigation.
|
Full Usage:
this.onceWillNavigate handler
Parameters:
IOnWillNavigate -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation on the main frame. It can happen when the window.location object is changed or a user clicks a link in the page.This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back.It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.Calling event.preventDefault() will prevent the navigation.
|
Full Usage:
this.onceWillNavigate handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation on the main frame. It can happen when the window.location object is changed or a user clicks a link in the page.This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back.It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.Calling event.preventDefault() will prevent the navigation.
|
Full Usage:
this.onceWillPreventUnload handler
Parameters:
Event -> unit
Modifiers: inline |
Emitted when a beforeunload event handler is attempting to cancel a page unload.Calling event.preventDefault() will ignore the beforeunload event handler and allow the page to be unloaded.> [!NOTE] This will be emitted for BrowserViews but will not be respected - this is because we have chosen not to tie the BrowserView lifecycle to its owning BrowserWindow should one exist per the specification.
|
Full Usage:
this.onceWillRedirect handler
Parameters:
IOnWillRedirect -> unit
Modifiers: inline |
Emitted when a server side redirect occurs during navigation. For example a 302 redirect.This event will be emitted after did-start-navigation and always before the did-redirect-navigation event for the same navigation.Calling event.preventDefault() will prevent the navigation (not just the redirect).
|
Full Usage:
this.onceWillRedirect handler
Parameters:
Details -> string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a server side redirect occurs during navigation. For example a 302 redirect.This event will be emitted after did-start-navigation and always before the did-redirect-navigation event for the same navigation.Calling event.preventDefault() will prevent the navigation (not just the redirect).
|
Full Usage:
this.onceZoomChanged handler
Parameters:
IOnZoomChanged -> unit
Modifiers: inline |
Emitted when the user is requesting to change the zoom level using the mouse wheel.
|
Full Usage:
this.onceZoomChanged handler
Parameters:
Event -> ZoomDirection -> unit
Modifiers: inline |
Emitted when the user is requesting to change the zoom level using the mouse wheel.
|
Full Usage:
this.openDevTools (mode, ?activate, ?title)
Parameters:
Mode
?activate : bool
?title : string
Modifiers: inline |
Opens the devtools.When contents is a
|
|
A WebFrameMain | null property that represents the frame that opened this WebContents, either with open(), or by navigating a link with a target attribute.
|
Full Usage:
this.paste ()
Modifiers: inline |
Executes the editing command paste in web page. |
Full Usage:
this.pasteAndMatchStyle ()
Modifiers: inline |
Executes the editing command pasteAndMatchStyle in web page. |
Full Usage:
this.postMessage (channel, message, ?transfer)
Parameters:
string
message : obj
?transfer : MessagePortMain[]
Modifiers: inline |
Send a message to the renderer process, optionally transferring ownership of zero or more MessagePortMain objects.The transferred MessagePortMain objects will be available in the renderer process by accessing the ports property of the emitted event. When they arrive in the renderer, they will be native DOM MessagePort objects.For example:
|
Full Usage:
this.print (?options, ?callback)
Parameters:
Options
?callback : bool * string -> unit
Modifiers: inline |
When a custom pageSize is passed, Chromium attempts to validate platform specific minimum values for width_microns and height_microns. Width and height must both be minimum 353 microns but may be higher on some operating systems.Prints window's web page. When silent is set to true, Electron will pick the system's default printer if deviceName is empty and the default settings for printing.Some possible failureReasons for print failure include:* "Invalid printer settings"* "Print job canceled"* "Print job failed"Use page-break-before: always; CSS style to force to print to a new page.Example usage:
|
Full Usage:
this.printToPDF (?landscape, ?displayHeaderFooter, ?printBackground, ?scale, ?pageSize, ?margins, ?pageRanges, ?headerTemplate, ?footerTemplate, ?preferCSSPageSize, ?generateTaggedPDF, ?generateDocumentOutline)
Parameters:
bool
?displayHeaderFooter : bool
?printBackground : bool
?scale : float
?pageSize : U2<PageSize, Size>
?margins : Margins
?pageRanges : string
?headerTemplate : string
?footerTemplate : string
?preferCSSPageSize : bool
?generateTaggedPDF : bool
?generateDocumentOutline : bool
Returns: Promise<Buffer>
Modifiers: inline |
Resolves with the generated PDF data.Prints the window's web page as PDF.The landscape will be ignored if @page CSS at-rule is used in the web page.An example of webContents.printToPDF:See Page.printToPdf for more information. |
Full Usage:
this.redo ()
Modifiers: inline |
Executes the editing command redo in web page. |
Full Usage:
this.reload ()
Modifiers: inline |
Reloads the current web page. |
Full Usage:
this.reloadIgnoringCache ()
Modifiers: inline |
Reloads current page and ignores cache. |
Full Usage:
this.removeInsertedCSS key
Parameters:
string
Returns: Promise<unit>
Modifiers: inline |
Resolves if the removal was successful.Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from contents.insertCSS(css).
|
Full Usage:
this.removeWorkSpace path
Parameters:
string
Modifiers: inline |
Removes the specified path from DevTools workspace.
|
Full Usage:
this.replace text
Parameters:
string
Modifiers: inline |
Executes the editing command replace in web page.
|
Full Usage:
this.replaceMisspelling text
Parameters:
string
Modifiers: inline |
Executes the editing command replaceMisspelling in web page.
|
|
|
Full Usage:
this.scrollToBottom ()
Modifiers: inline |
Scrolls to the bottom of the current webContents. |
Full Usage:
this.scrollToTop ()
Modifiers: inline |
Scrolls to the top of the current webContents. |
Full Usage:
this.selectAll ()
Modifiers: inline |
Executes the editing command selectAll in web page. |
Full Usage:
this.send (channel, ...args)
Parameters:
string
...args : obj[]
Modifiers: inline |
Send an asynchronous message to the renderer process via channel, along with arguments. Arguments will be serialized with the Structured Clone Algorithm, just like postMessage, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.:::warningSending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.:::For additional reading, refer to Electron's IPC guide.
|
Full Usage:
this.sendInputEvent inputEvent
Parameters:
U3<MouseInputEvent, MouseWheelInputEvent, KeyboardInputEvent>
Modifiers: inline |
Sends an input event to the page.> [!NOTE] The BrowserWindow containing the contents needs to be focused for sendInputEvent() to work.
|
Full Usage:
this.sendToFrame (frameId, channel, ...args)
Parameters:
U2<int, (float * float)>
channel : string
...args : obj[]
Modifiers: inline |
Send an asynchronous message to a specific frame in a renderer process via channel, along with arguments. Arguments will be serialized with the Structured Clone Algorithm, just like postMessage, so prototype chains will not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.> NOTE: Sending non-standard JavaScript types such as DOM objects or special Electron objects will throw an exception.The renderer process can handle the message by listening to channel with the ipcRenderer module.If you want to get the frameId of a given renderer context you should use the webFrame.routingId value. E.g.You can also read frameId from all incoming IPC messages in the main process.
|
|
A Session used by this webContents.
|
Full Usage:
this.setAudioMuted muted
Parameters:
bool
Modifiers: inline |
Mute the audio on the current web page.
|
Full Usage:
this.setBackgroundThrottling allowed
Parameters:
bool
Modifiers: inline |
Controls whether or not this WebContents will throttle animations and timers when the page becomes backgrounded. This also affects the Page Visibility API.
|
Full Usage:
this.setDevToolsTitle title
Parameters:
string
Modifiers: inline |
Changes the title of the DevTools window to title. This will only be visible if DevTools is opened in undocked or detach mode.
|
Full Usage:
this.setDevToolsWebContents devToolsWebContents
Parameters:
WebContents
Modifiers: inline |
Uses the devToolsWebContents as the target WebContents to show devtools.The devToolsWebContents must not have done any navigation, and it should
not be used for other purposes after the call.By default Electron manages the devtools by creating an internal WebContents with
native view, which developers have very limited control of. With the setDevToolsWebContents method, developers can use any WebContents to show
the devtools in it, including BrowserWindow, BrowserView and
|
Full Usage:
this.setFrameRate fps
Parameters:
int
Modifiers: inline |
If offscreen rendering is enabled sets the frame rate to the specified number. Only values between 1 and 240 are accepted.
|
Full Usage:
this.setIgnoreMenuShortcuts ignore
Parameters:
bool
Modifiers: inline |
Ignore application menu shortcuts while this web contents is focused.
|
|
Sets the image animation policy for this webContents. The policy only affects new images, existing images that are currently being animated are unaffected. This is a known limitation in Chromium, you can force image animation to be recalculated with img.src = img.src which will result in no network traffic but will update the animation policy.This corresponds to the animationPolicy accessibility feature in Chromium.
|
Full Usage:
this.setUserAgent userAgent
Parameters:
string
Modifiers: inline |
Overrides the user agent for this web page.
|
Full Usage:
this.setVisualZoomLevelLimits (minimumLevel, maximumLevel)
Parameters:
float
maximumLevel : float
Returns: Promise<unit>
Modifiers: inline |
Sets the maximum and minimum pinch-to-zoom level.> [!NOTE] Visual zoom is disabled by default in Electron. To re-enable it, call:
|
|
Setting the WebRTC IP handling policy allows you to control which IPs are exposed via WebRTC. See BrowserLeaks for more details.
|
Full Usage:
this.setWebRTCUDPPortRange (min, max)
Parameters:
int
max : int
Modifiers: inline |
Setting the WebRTC UDP Port Range allows you to restrict the udp port range used by WebRTC. By default the port range is unrestricted.> [!NOTE] To reset to an unrestricted port range this value should be set to { min: 0, max: 0 }.
|
Full Usage:
this.setWindowOpenHandler handler
Parameters:
Details -> WindowOpenHandlerResponse
Modifiers: inline |
Called before creating a window a new window is requested by the renderer, e.g. by window.open(), a link with target="_blank", shift+clicking on a link, or submitting a form with
|
Full Usage:
this.setZoomFactor factor
Parameters:
double
Modifiers: inline |
Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.The factor must be greater than 0.0.
|
Full Usage:
this.setZoomLevel level
Parameters:
float
Modifiers: inline |
Changes the zoom level to the specified level. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is scale := 1.2 ^ level.> [!NOTE] The zoom policy at the Chromium level is same-origin, meaning that the zoom level for a specific domain propagates across all instances of windows with the same domain. Differentiating the window URLs will make zoom work per-window.
|
Full Usage:
this.showDefinitionForSelection ()
Modifiers: inline |
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Shows pop-up dictionary that searches the selected word on the page. |
Full Usage:
this.startDrag (file, ?files, ?icon)
Parameters:
string
?files : string[]
?icon : U2<NativeImage, string>
Modifiers: inline |
Sets the item as dragging item for current drag-drop operation, file is the absolute path of the file to be dragged, and icon is the image showing under the cursor when dragging.
|
Full Usage:
this.startPainting ()
Modifiers: inline |
If offscreen rendering is enabled and not painting, start painting. |
Full Usage:
this.stop ()
Modifiers: inline |
Stops any pending navigation. |
|
Stops any findInPage request for the webContents with the provided action.
|
Full Usage:
this.stopPainting ()
Modifiers: inline |
If offscreen rendering is enabled and painting, stop painting. |
Full Usage:
this.takeHeapSnapshot filePath
Parameters:
string
Returns: Promise<unit>
Modifiers: inline |
Indicates whether the snapshot has been created successfully.Takes a V8 heap snapshot and saves it to filePath.
|
Full Usage:
this.toggleDevTools ()
Modifiers: inline |
Toggles the developer tools. |
Full Usage:
this.undo ()
Modifiers: inline |
Executes the editing command undo in web page. |
Full Usage:
this.unselect ()
Modifiers: inline |
Executes the editing command unselect in web page. |
Full Usage:
this.userAgent
|
A string property that determines the user agent for this web page. |
Full Usage:
this.zoomFactor
|
A number property that determines the zoom factor for this web contents.The zoom factor is the zoom percent divided by 100, so 300% = 3.0. |
Full Usage:
this.zoomLevel
|
A number property that determines the zoom level for this web contents.The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. The formula for this is scale := 1.2 ^ level. |
fable-electron-docs-api