Skip to content

ElectronWebviewTag

Unofficial

Electron WebviewTag for embedding external web content in the application.

Import:

import type { ElectronWebviewTag } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface ElectronWebviewTag extends HTMLElement

Extends: HTMLElement

Properties

Property Type Description
_EVENTS? {
K in keyof [HTMLElementEventMap]?: EventListenerInfo[];
}
The event listeners of the element.
(Inherited from HTMLElement)
allowpopups boolean Whether to allow popups.
disableblinkfeatures string The Blink features to disable.
disablewebsecurity boolean Whether to disable web security.
enableblinkfeatures string The Blink features to enable.
httpreferrer string The HTTP referrer URL.
innerHeight number Get the inner height of this element without padding.
(Inherited from HTMLElement)
innerWidth number Get the inner width of this element without padding.
(Inherited from HTMLElement)
nodeintegration boolean Whether to enable Node.js integration.
nodeintegrationinsubframes boolean Whether to enable Node.js integration in sub-frames.
partition string The session partition string.
plugins boolean Whether to enable plugins.
preload string The path to the preload script.
src string The URL to load.
useragent string The user agent string.
webpreferences string The web preferences string.

Methods

Method Returns Description
addEventListener(type, listener, options?) void Registers an event listener.
canGoBack() boolean Returns whether the webview can navigate back.
canGoForward() boolean Returns whether the webview can navigate forward.
canGoToOffset(offset) boolean Returns whether the webview can navigate to the given offset.
capturePage(rect?) Promise<ElectronNativeImage> Captures a snapshot of the page.
clearHistory() void Clears the navigation history.
closeDevTools() void Closes the developer tools.
copy() void Copies the selected text to the clipboard.
cut() void Cuts the selected text to the clipboard.
delete() void Deletes the selected text.
downloadURL(url) void Initiates a download of the resource at the given URL without navigating.
executeJavaScript(code, userGesture?) Promise<unknown> Evaluates JavaScript code in the context of the page.
findInPage(text, options?) number Starts finding text in the page.
getTitle() string Returns the title of the page.
getURL() string Returns the URL of the current page.
getUserAgent() string Returns the user agent string.
getWebContentsId() number Returns the web contents id.
getZoomFactor() number Returns the current zoom factor.
getZoomLevel() number Returns the current zoom level.
goBack() void Navigates back.
goForward() void Navigates forward.
goToIndex(index) void Navigates to the specified history index.
goToOffset(offset) void Navigates to the specified history offset.
hide() void Hides the element using css display property.
(Inherited from HTMLElement)
insertCSS(css) Promise<string> Injects CSS into the page.
insertText(text) Promise<void> Inserts text at the current cursor position.
inspectElement(x, y) void Inspects the element at the given position.
inspectServiceWorker() void Opens the developer tools for the service worker context present in the guest page.
inspectSharedWorker() void Opens the developer tools for the shared worker context present in the guest page.
isAudioMuted() boolean Returns whether the page audio is muted.
isCrashed() boolean Returns whether the page renderer process has crashed.
isCurrentlyAudible() boolean Returns whether the page is currently producing audio.
isDevToolsFocused() boolean Returns whether the developer tools are focused.
isDevToolsOpened() boolean Returns whether the developer tools are opened.
isLoading() boolean Returns whether the page is loading resources.
isLoadingMainFrame() boolean Returns whether the main frame of the page is loading.
isShown() boolean Returns whether this element is shown, when the element is attached to the DOM and none of the parent and ancestor elements are hidden with display: none.

Exception: Does not work on <body> and <html>, or on elements with position: fixed.
(Inherited from HTMLElement)
isWaitingForResponse() boolean Returns whether the page is waiting for a first response.
loadURL(url, options?) Promise<void> Loads the given URL.
off(this, type, selector, listener, options?) void Removes an event listener from the element.
(Inherited from HTMLElement)
on(this, type, selector, listener, options?) void Adds an event listener to the element.
(Inherited from HTMLElement)
onClickEvent(this, listener, options?) void Adds a click event listener to the element.
(Inherited from HTMLElement)
onNodeInserted(this, listener, once?) () => void Adds an event listener to the element when it is inserted into the DOM.
(Inherited from HTMLElement)
onWindowMigrated(this, listener) () => void Adds an event listener to the element when it is migrated to another window.
(Inherited from HTMLElement)
openDevTools() void Opens the developer tools.
paste() void Pastes from the clipboard.
pasteAndMatchStyle() void Pastes and matches the style of the current text.
print(options?) Promise<void> Prints the page.
printToPDF(options) Promise<Uint8Array> Prints the page as a PDF.
redo() void Redoes the last undone action.
reload() void Reloads the page.
reloadIgnoringCache() void Reloads the page ignoring the cache.
removeEventListener(type, listener, options?) void Removes an event listener.
removeInsertedCSS(key) Promise<void> Removes previously injected CSS.
replace(text) void Replaces the current text with the given text.
replaceMisspelling(text) void Replaces the misspelled word with the given text.
selectAll() void Selects all text on the page.
send(channel, args?) Promise<void> Sends an asynchronous message to the renderer process.
sendInputEvent(inputEvent) Promise<void> Sends an input event to the page.
sendToFrame(frameId, channel, args?) Promise<void> Sends a message to a specific frame in the renderer process.
setAudioMuted(muted) void Sets whether the page audio is muted.
setCssProps(props) void Sets the CSS properties of the element.
(Inherited from HTMLElement)
setCssStyles(styles) void Sets the CSS styles of the element.
(Inherited from HTMLElement)
setUserAgent(userAgent) void Sets the user agent string.
setVisualZoomLevelLimits(minimumLevel, maximumLevel) Promise<void> Sets the maximum and minimum pinch-to-zoom level.
setZoomFactor(factor) void Sets the zoom factor of the page.
setZoomLevel(level) void Sets the zoom level of the page.
show() void Shows the element using css display property.
(Inherited from HTMLElement)
showDefinitionForSelection() void Shows a pop-up dictionary that searches the selected word on the page.
stop() void Stops loading the page.
stopFindInPage(action) void Stops the find in page request.
toggle(show) void Toggles the visibility of the element using css display property.
(Inherited from HTMLElement)
toggleVisibility(visible) void Toggles the visibility of the element using css visibility property.
(Inherited from HTMLElement)
trigger(eventType) void Triggers an event on the element.
(Inherited from HTMLElement)
undo() void Undoes the last action.
unselect() void Clears the current selection.

Links to this page: