WebviewTag Type
⚠ Process Availability: Main ❌ | Renderer ✔ | Utility ❌ | Exported ❌### WarningElectron's webview tag is based on Chromium's webview, which is undergoing dramatic architectural changes. This impacts the stability of
webviews, including rendering, navigation, and event routing. We currently recommend to not use the webview tag and to consider alternatives,
like iframe, a WebContentsView, or an architecture that avoids embedded content altogether.### EnablingBy default the webview tag is disabled in
Electron >= 5. You need to enable the tag by setting the webviewTag webPreferences option when constructing your BrowserWindow.
For more information see the BrowserWindow constructor docs.### Overview> Display external web content in an isolated frame and process.Process: Renderer
_This class is not exported from the 'electron' module. It is only available as a return value of other methods
in the Electron API._Use the webview tag to embed 'guest' content (such as web pages) in your Electron app. The
guest content is contained within the webview container. An embedded page within your app controls how the guest content is
laid out and rendered.Unlike an iframe, the webview runs in a separate process than your app. It doesn't have the
same permissions as your web page and all interactions between your app and embedded content will be asynchronous. This keeps
your app safe from the embedded content.> [!NOTE] Most methods called on the webview from the host page require a
synchronous call to the main process.### ExampleTo embed a web page in your app, add the webview tag to your
app's embedder page (this is the app page that will display the guest content). In its simplest form, the webview
tag includes the src of the web page and css styles that control the appearance of the webview container:
Instance members
| Instance member |
Description
|
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.See webContents.adjustSelection for examples.
|
Full Usage:
this.allowpopups
|
A boolean. When this attribute is present the guest page will be allowed to open new windows. Popups are disabled by default. |
Full Usage:
this.canGoBack ()
Returns: bool
Modifiers: inline |
Whether the guest page can go back.
|
Full Usage:
this.canGoForward ()
Returns: bool
Modifiers: inline |
Whether the guest page can go forward.
|
Full Usage:
this.canGoToOffset offset
Parameters:
int
Returns: bool
Modifiers: inline |
Whether the guest page can go to offset.
|
Full Usage:
this.capturePage ?rect
Parameters:
Rectangle
Returns: Promise<NativeImage>
Modifiers: inline |
Resolves with a NativeImageCaptures a snapshot of the page within rect. Omitting rect will capture the whole visible page.
|
Full Usage:
this.centerSelection ()
Modifiers: inline |
Centers the current text selection in page. |
Full Usage:
this.clearHistory ()
Modifiers: inline |
Clears the navigation history. |
Full Usage:
this.closeDevTools ()
Modifiers: inline |
Closes the DevTools window of guest page. |
Full Usage:
this.copy ()
Modifiers: inline |
Executes editing command copy in page. |
Full Usage:
this.cut ()
Modifiers: inline |
Executes editing command cut in page. |
Full Usage:
this.delete ()
Modifiers: inline |
Executes editing command delete in page. |
Full Usage:
this.disableblinkfeatures
|
A string which is a list of strings which specifies the blink features to be disabled separated by ,. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file. |
Full Usage:
this.disablewebsecurity
|
A boolean. When this attribute is present the guest page will have web security disabled. Web security is enabled by default.This value can only be modified before the first navigation. |
Full Usage:
this.downloadURL (url, ?headers)
Parameters:
string
?headers : Record<string, string>
Modifiers: inline |
Initiates a download of the resource at url without navigating.
|
Full Usage:
this.enableblinkfeatures
|
A string which is a list of strings which specifies the blink features to be enabled separated by ,. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file. |
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. If userGesture is set, it will create the user gesture context in the page. HTML APIs like requestFullScreen, which require user action, can take advantage of this option for automation.
|
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.getTitle ()
Returns: string
Modifiers: inline |
The title of guest page.
|
Full Usage:
this.getURL ()
Returns: string
Modifiers: inline |
The URL of guest page.
|
Full Usage:
this.getUserAgent ()
Returns: string
Modifiers: inline |
The user agent for guest page.
|
Full Usage:
this.getWebContentsId ()
Returns: float
Modifiers: inline |
The WebContents ID of this webview.
|
Full Usage:
this.getZoomFactor ()
Returns: float
Modifiers: inline |
the current zoom factor.
|
Full Usage:
this.getZoomLevel ()
Returns: float
Modifiers: inline |
the current zoom level.
|
Full Usage:
this.goBack ()
Modifiers: inline |
Makes the guest page go back. |
Full Usage:
this.goForward ()
Modifiers: inline |
Makes the guest page go forward. |
Full Usage:
this.goToIndex index
Parameters:
int
Modifiers: inline |
Navigates to the specified absolute index.
|
Full Usage:
this.goToOffset offset
Parameters:
int
Modifiers: inline |
Navigates to the specified offset from the "current entry".
|
Full Usage:
this.httpreferrer
|
A string that sets the referrer URL for the guest page. |
|
A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS
via
|
|
|
Full Usage:
this.inspectElement (x, y)
Parameters:
int
y : int
Modifiers: inline |
Starts inspecting element at position (x, y) of guest page.
|
Full Usage:
this.inspectServiceWorker ()
Modifiers: inline |
Opens the DevTools for the service worker context present in the guest page. |
Full Usage:
this.inspectSharedWorker ()
Modifiers: inline |
Opens the DevTools for the shared worker context present in the guest page. |
Full Usage:
this.isAudioMuted ()
Returns: bool
Modifiers: inline |
Whether guest page has been muted.
|
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.isDevToolsFocused ()
Returns: bool
Modifiers: inline |
Whether DevTools window of guest page is focused.
|
Full Usage:
this.isDevToolsOpened ()
Returns: bool
Modifiers: inline |
Whether guest page has a DevTools window attached.
|
Full Usage:
this.isLoading ()
Returns: bool
Modifiers: inline |
Whether guest 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.isWaitingForResponse ()
Returns: bool
Modifiers: inline |
Whether the guest page is waiting for a first-response for the main resource of the page.
|
Full Usage:
this.loadURL (url, ?httpReferrer, ?userAgent, ?extraHeaders, ?postData, ?baseURLForDataURL)
Parameters:
URL
?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).Loads the url in the webview, the url must contain the protocol prefix, e.g. the http:// or file://.
|
Full Usage:
this.nodeintegration
|
A boolean. When this attribute is present the guest page in webview will have node integration and can use node APIs like require and process to access low level system resources. Node integration is disabled by default in the guest page. |
Full Usage:
this.nodeintegrationinsubframes
|
A boolean for the experimental option for enabling NodeJS support in sub-frames such as iframes inside the webview. All your preloads will load for every iframe, you can use process.isMainFrame to determine if you are in the main frame or not. This option is disabled by default in the guest page. |
Full Usage:
this.offClose handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when the guest page attempts to close itself.The following example code navigates the webview to about:blank when the guest attempts to close itself.
|
Full Usage:
this.offConsoleMessage handler
Parameters:
IOnConsoleMessage -> unit
Modifiers: inline |
Fired when the guest window logs a console message.The following example code forwards all log messages to the embedder's console without regard for log level or other properties.
|
Full Usage:
this.offConsoleMessage handler
Parameters:
int -> string -> int -> string -> unit
Modifiers: inline |
Fired when the guest window logs a console message.The following example code forwards all log messages to the embedder's console without regard for log level or other properties.
|
|
Emitted when there is a new context menu that needs to be handled.
|
Full Usage:
this.offDestroyed handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when the 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:
string -> unit
Modifiers: inline |
|
Full Usage:
this.offDevtoolsOpened handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is opened.
|
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.offDidAttach handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when attached to the embedder web contents.
|
Full Usage:
this.offDidChangeThemeColor handler
Parameters:
string -> unit
Modifiers: inline |
Emitted when a page's theme color changes. This is usually due to encountering a meta tag:
|
Full Usage:
this.offDidFailLoad handler
Parameters:
IOnDidFailLoad -> unit
Modifiers: inline |
This event is like did-finish-load, but fired when the load failed or was cancelled, e.g. window.stop() is invoked.
|
Full Usage:
this.offDidFailLoad handler
Parameters:
int -> string -> string -> bool -> unit
Modifiers: inline |
This event is like did-finish-load, but fired when the load failed or was cancelled, e.g. window.stop() is invoked.
|
Full Usage:
this.offDidFinishLoad handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when the navigation is done, i.e. the spinner of the tab will stop spinning, and the onload event is dispatched.
|
Full Usage:
this.offDidFrameFinishLoad handler
Parameters:
bool -> unit
Modifiers: inline |
Fired 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:
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:
string -> unit
Modifiers: inline |
Emitted when a 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.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:
bool -> string -> unit
Modifiers: inline |
Emitted when an in-page navigation happened.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.
|
Full Usage:
this.offDidRedirectNavigation handler
Parameters:
string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted after a server side redirect occurs during navigation. For example a 302 redirect.
|
Full Usage:
this.offDidStartLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab starts spinning.
|
Full Usage:
this.offDidStartNavigation handler
Parameters:
IOnDidStartNavigation -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating. isInPlace will be true for in-page navigations.
|
Full Usage:
this.offDidStartNavigation handler
Parameters:
string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating. isInPlace will be true for in-page navigations.
|
Full Usage:
this.offDidStopLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab stops spinning.
|
Full Usage:
this.offDomReady handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when document in the given frame is loaded.
|
Full Usage:
this.offEnterHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when page enters fullscreen triggered by HTML API.
|
|
Fired when a result is available for webview.findInPage request.
|
Full Usage:
this.offIpcMessage handler
Parameters:
IOnIpcMessage -> unit
Modifiers: inline |
Fired when the guest page has sent an asynchronous message to embedder page.With sendToHost method and ipc-message event you can communicate between guest page and embedder page:
|
Full Usage:
this.offIpcMessage handler
Parameters:
float * float -> string -> obj[] -> unit
Modifiers: inline |
Fired when the guest page has sent an asynchronous message to embedder page.With sendToHost method and ipc-message event you can communicate between guest page and embedder page:
|
Full Usage:
this.offLeaveHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when page leaves fullscreen triggered by HTML API.
|
Full Usage:
this.offLoadCommit handler
Parameters:
IOnLoadCommit -> unit
Modifiers: inline |
Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.
|
Full Usage:
this.offLoadCommit handler
Parameters:
string -> bool -> unit
Modifiers: inline |
Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.
|
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:
string[] -> unit
Modifiers: inline |
Fired 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:
string -> bool -> unit
Modifiers: inline |
Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.
|
Full Usage:
this.offRenderProcessGone handler
Parameters:
RenderProcessGoneDetails -> unit
Modifiers: inline |
Fired when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.
|
Full Usage:
this.offUpdateTargetUrl handler
Parameters:
string -> unit
Modifiers: inline |
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
Full Usage:
this.offWillFrameNavigate handler
Parameters:
IOnWillFrameNavigate -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation anywhere in the
|
Full Usage:
this.offWillFrameNavigate handler
Parameters:
string -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation anywhere in the
|
Full Usage:
this.offWillNavigate handler
Parameters:
string -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation. 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
|
Full Usage:
this.onClose handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when the guest page attempts to close itself.The following example code navigates the webview to about:blank when the guest attempts to close itself.
|
Full Usage:
this.onConsoleMessage handler
Parameters:
IOnConsoleMessage -> unit
Modifiers: inline |
Fired when the guest window logs a console message.The following example code forwards all log messages to the embedder's console without regard for log level or other properties.
|
Full Usage:
this.onConsoleMessage handler
Parameters:
int -> string -> int -> string -> unit
Modifiers: inline |
Fired when the guest window logs a console message.The following example code forwards all log messages to the embedder's console without regard for log level or other properties.
|
|
Emitted when there is a new context menu that needs to be handled.
|
Full Usage:
this.onDestroyed handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when the 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:
string -> unit
Modifiers: inline |
|
Full Usage:
this.onDevtoolsOpened handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is opened.
|
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.onDidAttach handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when attached to the embedder web contents.
|
Full Usage:
this.onDidChangeThemeColor handler
Parameters:
string -> unit
Modifiers: inline |
Emitted when a page's theme color changes. This is usually due to encountering a meta tag:
|
Full Usage:
this.onDidFailLoad handler
Parameters:
IOnDidFailLoad -> unit
Modifiers: inline |
This event is like did-finish-load, but fired when the load failed or was cancelled, e.g. window.stop() is invoked.
|
Full Usage:
this.onDidFailLoad handler
Parameters:
int -> string -> string -> bool -> unit
Modifiers: inline |
This event is like did-finish-load, but fired when the load failed or was cancelled, e.g. window.stop() is invoked.
|
Full Usage:
this.onDidFinishLoad handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when the navigation is done, i.e. the spinner of the tab will stop spinning, and the onload event is dispatched.
|
Full Usage:
this.onDidFrameFinishLoad handler
Parameters:
bool -> unit
Modifiers: inline |
Fired 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:
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:
string -> unit
Modifiers: inline |
Emitted when a 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.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:
bool -> string -> unit
Modifiers: inline |
Emitted when an in-page navigation happened.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.
|
Full Usage:
this.onDidRedirectNavigation handler
Parameters:
string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted after a server side redirect occurs during navigation. For example a 302 redirect.
|
Full Usage:
this.onDidStartLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab starts spinning.
|
Full Usage:
this.onDidStartNavigation handler
Parameters:
IOnDidStartNavigation -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating. isInPlace will be true for in-page navigations.
|
Full Usage:
this.onDidStartNavigation handler
Parameters:
string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating. isInPlace will be true for in-page navigations.
|
Full Usage:
this.onDidStopLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab stops spinning.
|
Full Usage:
this.onDomReady handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when document in the given frame is loaded.
|
Full Usage:
this.onEnterHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when page enters fullscreen triggered by HTML API.
|
|
Fired when a result is available for webview.findInPage request.
|
|
Fired when the guest page has sent an asynchronous message to embedder page.With sendToHost method and ipc-message event you can communicate between guest page and embedder page:
|
Full Usage:
this.onIpcMessage handler
Parameters:
float * float -> string -> obj[] -> unit
Modifiers: inline |
Fired when the guest page has sent an asynchronous message to embedder page.With sendToHost method and ipc-message event you can communicate between guest page and embedder page:
|
Full Usage:
this.onLeaveHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when page leaves fullscreen triggered by HTML API.
|
|
Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.
|
Full Usage:
this.onLoadCommit handler
Parameters:
string -> bool -> unit
Modifiers: inline |
Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.
|
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:
string[] -> unit
Modifiers: inline |
Fired 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:
string -> bool -> unit
Modifiers: inline |
Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.
|
Full Usage:
this.onRenderProcessGone handler
Parameters:
RenderProcessGoneDetails -> unit
Modifiers: inline |
Fired when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.
|
Full Usage:
this.onUpdateTargetUrl handler
Parameters:
string -> unit
Modifiers: inline |
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
Full Usage:
this.onWillFrameNavigate handler
Parameters:
IOnWillFrameNavigate -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation anywhere in the
|
Full Usage:
this.onWillFrameNavigate handler
Parameters:
string -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation anywhere in the
|
Full Usage:
this.onWillNavigate handler
Parameters:
string -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation. 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
|
Full Usage:
this.onceClose handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when the guest page attempts to close itself.The following example code navigates the webview to about:blank when the guest attempts to close itself.
|
Full Usage:
this.onceConsoleMessage handler
Parameters:
IOnConsoleMessage -> unit
Modifiers: inline |
Fired when the guest window logs a console message.The following example code forwards all log messages to the embedder's console without regard for log level or other properties.
|
Full Usage:
this.onceConsoleMessage handler
Parameters:
int -> string -> int -> string -> unit
Modifiers: inline |
Fired when the guest window logs a console message.The following example code forwards all log messages to the embedder's console without regard for log level or other properties.
|
|
Emitted when there is a new context menu that needs to be handled.
|
Full Usage:
this.onceDestroyed handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when the 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:
string -> unit
Modifiers: inline |
|
Full Usage:
this.onceDevtoolsOpened handler
Parameters:
unit -> unit
Modifiers: inline |
Emitted when DevTools is opened.
|
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.onceDidAttach handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when attached to the embedder web contents.
|
Full Usage:
this.onceDidChangeThemeColor handler
Parameters:
string -> unit
Modifiers: inline |
Emitted when a page's theme color changes. This is usually due to encountering a meta tag:
|
Full Usage:
this.onceDidFailLoad handler
Parameters:
IOnDidFailLoad -> unit
Modifiers: inline |
This event is like did-finish-load, but fired when the load failed or was cancelled, e.g. window.stop() is invoked.
|
Full Usage:
this.onceDidFailLoad handler
Parameters:
int -> string -> string -> bool -> unit
Modifiers: inline |
This event is like did-finish-load, but fired when the load failed or was cancelled, e.g. window.stop() is invoked.
|
Full Usage:
this.onceDidFinishLoad handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when the navigation is done, i.e. the spinner of the tab will stop spinning, and the onload event is dispatched.
|
Full Usage:
this.onceDidFrameFinishLoad handler
Parameters:
bool -> unit
Modifiers: inline |
Fired 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:
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:
string -> unit
Modifiers: inline |
Emitted when a 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.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:
bool -> string -> unit
Modifiers: inline |
Emitted when an in-page navigation happened.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.
|
Full Usage:
this.onceDidRedirectNavigation handler
Parameters:
string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted after a server side redirect occurs during navigation. For example a 302 redirect.
|
Full Usage:
this.onceDidStartLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab starts spinning.
|
Full Usage:
this.onceDidStartNavigation handler
Parameters:
IOnDidStartNavigation -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating. isInPlace will be true for in-page navigations.
|
Full Usage:
this.onceDidStartNavigation handler
Parameters:
string -> bool -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when any frame (including main) starts navigating. isInPlace will be true for in-page navigations.
|
Full Usage:
this.onceDidStopLoading handler
Parameters:
unit -> unit
Modifiers: inline |
Corresponds to the points in time when the spinner of the tab stops spinning.
|
Full Usage:
this.onceDomReady handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when document in the given frame is loaded.
|
Full Usage:
this.onceEnterHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when page enters fullscreen triggered by HTML API.
|
|
Fired when a result is available for webview.findInPage request.
|
Full Usage:
this.onceIpcMessage handler
Parameters:
IOnIpcMessage -> unit
Modifiers: inline |
Fired when the guest page has sent an asynchronous message to embedder page.With sendToHost method and ipc-message event you can communicate between guest page and embedder page:
|
Full Usage:
this.onceIpcMessage handler
Parameters:
float * float -> string -> obj[] -> unit
Modifiers: inline |
Fired when the guest page has sent an asynchronous message to embedder page.With sendToHost method and ipc-message event you can communicate between guest page and embedder page:
|
Full Usage:
this.onceLeaveHtmlFullScreen handler
Parameters:
unit -> unit
Modifiers: inline |
Fired when page leaves fullscreen triggered by HTML API.
|
Full Usage:
this.onceLoadCommit handler
Parameters:
IOnLoadCommit -> unit
Modifiers: inline |
Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.
|
Full Usage:
this.onceLoadCommit handler
Parameters:
string -> bool -> unit
Modifiers: inline |
Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does not include asynchronous resource loads.
|
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:
string[] -> unit
Modifiers: inline |
Fired 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:
string -> bool -> unit
Modifiers: inline |
Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.
|
Full Usage:
this.onceRenderProcessGone handler
Parameters:
RenderProcessGoneDetails -> unit
Modifiers: inline |
Fired when the renderer process unexpectedly disappears. This is normally because it was crashed or killed.
|
Full Usage:
this.onceUpdateTargetUrl handler
Parameters:
string -> unit
Modifiers: inline |
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
|
Full Usage:
this.onceWillFrameNavigate handler
Parameters:
IOnWillFrameNavigate -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation anywhere in the
|
Full Usage:
this.onceWillFrameNavigate handler
Parameters:
string -> bool -> int -> int -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation anywhere in the
|
Full Usage:
this.onceWillNavigate handler
Parameters:
string -> unit
Modifiers: inline |
Emitted when a user or the page wants to start navigation. 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
|
Full Usage:
this.openDevTools ()
Modifiers: inline |
Opens a DevTools window for guest page. |
Full Usage:
this.partition
|
A string that sets the session used by the page. If partition starts with persist:, the page will use a persistent session available to all pages in the app with the same partition. if there is no persist: prefix, the page will use an in-memory session. By assigning the same partition, multiple pages can share the same session. If the partition is unset then default session of the app will be used.This value can only be modified before the first navigation, since the session of an active renderer process cannot change. Subsequent attempts to modify the value will fail with a DOM exception. |
Full Usage:
this.paste ()
Modifiers: inline |
Executes editing command paste in page. |
Full Usage:
this.pasteAndMatchStyle ()
Modifiers: inline |
Executes editing command pasteAndMatchStyle in page. |
Full Usage:
this.plugins
|
A boolean. When this attribute is present the guest page in webview will be able to use browser plugins. Plugins are disabled by default. |
Full Usage:
this.preload
|
A string that specifies a script that will be loaded before other scripts run in the guest page. The protocol of script's URL must be file: (even when using asar: archives) because it will be loaded by Node's require under the hood, which treats asar: archives as virtual directories.When the guest page doesn't have node integration this script will still have access to all Node APIs, but global objects injected by Node will be deleted after this script has finished executing. |
Full Usage:
this.print (?silent, ?printBackground, ?deviceName, ?color, ?margins, ?landscape, ?scaleFactor, ?pagesPerSheet, ?collate, ?copies, ?pageRanges, ?duplexMode, ?dpi, ?header, ?footer, ?pageSize)
Parameters:
bool
?printBackground : bool
?deviceName : string
?color : bool
?margins : Margins
?landscape : bool
?scaleFactor : float
?pagesPerSheet : float
?collate : bool
?copies : float
?pageRanges : PageRanges[]
?duplexMode : DuplexMode
?dpi : Record<string, float>
?header : string
?footer : string
?pageSize : U2<PageSize, Size>
Returns: Promise<unit>
Modifiers: inline |
Prints webview's web page. Same as webContents.print([options]).
|
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<Uint8Array>
Modifiers: inline |
Resolves with the generated PDF data.Prints webview's web page as PDF, Same as webContents.printToPDF(options).
|
Full Usage:
this.redo ()
Modifiers: inline |
Executes editing command redo in page. |
Full Usage:
this.reload ()
Modifiers: inline |
Reloads the guest page. |
Full Usage:
this.reloadIgnoringCache ()
Modifiers: inline |
Reloads the guest 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
|
Full Usage:
this.replace text
Parameters:
string
Modifiers: inline |
Executes editing command replace in page.
|
Full Usage:
this.replaceMisspelling text
Parameters:
string
Modifiers: inline |
Executes editing command replaceMisspelling in page.
|
Full Usage:
this.scrollToBottom ()
Modifiers: inline |
Scrolls to the bottom of the current |
Full Usage:
this.scrollToTop ()
Modifiers: inline |
Scrolls to the top of the current |
Full Usage:
this.selectAll ()
Modifiers: inline |
Executes editing command selectAll in page. |
Full Usage:
this.send (channel, ...args)
Parameters:
string
...args : obj[]
Returns: Promise<unit>
Modifiers: inline |
Send an asynchronous message to renderer process via channel, you can also send arbitrary arguments. The renderer process can handle the message by listening to the channel event with the ipcRenderer module.See webContents.send for examples.
|
Full Usage:
this.sendInputEvent event
Parameters:
U3<MouseInputEvent, MouseWheelInputEvent, KeyboardInputEvent>
Returns: Promise<unit>
Modifiers: inline |
Sends an input event to the page.See webContents.sendInputEvent for detailed description of event object.
|
Full Usage:
this.sendToFrame (frameId, channel, ...args)
Parameters:
float * float
channel : string
...args : obj[]
Returns: Promise<unit>
Modifiers: inline |
Send an asynchronous message to renderer process via channel, you can also send arbitrary arguments. The renderer process can handle the message by listening to the channel event with the ipcRenderer module.See webContents.sendToFrame for examples.
|
Full Usage:
this.setAudioMuted muted
Parameters:
bool
Modifiers: inline |
Set guest page muted.
|
Full Usage:
this.setUserAgent userAgent
Parameters:
string
Modifiers: inline |
Overrides the user agent for the guest 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.
|
Full Usage:
this.setZoomFactor factor
Parameters:
float
Modifiers: inline |
Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.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.src
|
A string representing the visible URL. Writing to this attribute initiates top-level navigation.Assigning src its own value will reload the current page.The src attribute can also accept data URLs, such as data:text/plain,Hello, world!. |
Full Usage:
this.stop ()
Modifiers: inline |
Stops any pending navigation. |
|
Stops any findInPage request for the webview with the provided action.
|
Full Usage:
this.undo ()
Modifiers: inline |
Executes editing command undo in page. |
Full Usage:
this.unselect ()
Modifiers: inline |
Executes editing command unselect in page. |
Full Usage:
this.useragent
|
A string that sets the user agent for the guest page before the page is navigated to. Once the page is loaded, use the setUserAgent method to change the user agent. |
Full Usage:
this.webpreferences
|
A string which is a comma separated list of strings which specifies the web preferences to be set on the webview. The full list of supported preference strings can be found in BrowserWindow.The string follows the same format as the features string in window.open. A name by itself is given a true boolean value. A preference can be set to another value by including an =, followed by the value. Special values yes and 1 are interpreted as true, while no and 0 are interpreted as false. |
fable-electron-docs-api