Skip to content

ElectronWebFrame

Unofficial

Electron WebFrame for customizing the rendering of the current web page in the renderer process.

Import:

import type { ElectronWebFrame } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface ElectronWebFrame

Properties

Property Type Description
firstChild ElectronWebFrame | null The first child frame of webFrame, or null if webFrame has no children or if the first child is not in the current renderer process.
nextSibling ElectronWebFrame | null The next sibling frame, or null if webFrame is the last frame in its parent or if the next sibling is not in the current renderer process.
opener ElectronWebFrame | null The frame which opened webFrame, or null if there is no opener or the opener is not in the current renderer process.
parent ElectronWebFrame | null The parent frame of webFrame, or null if webFrame is top or the parent is not in the current renderer process.
routingId number The unique frame id in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same routingId.
top ElectronWebFrame | null The top frame in the frame hierarchy to which webFrame belongs, or null if the top frame is not in the current renderer process.

Methods

Method Returns Description
clearCache() void Attempts to free memory that is no longer being used (like images from a previous navigation).
executeJavaScript(code, userGesture?, callback?) Promise<unknown> Evaluates code in the 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.
executeJavaScriptInIsolatedWorld(worldId, scripts, userGesture?, callback?) Promise<unknown> Works like executeJavaScript but evaluates scripts in an isolated context. When the execution of a script fails, the returned promise will not reject and the result would be undefined.
findFrameByName(name) ElectronWebFrame Returns a child of webFrame with the supplied name.
findFrameByRoutingId(routingId) ElectronWebFrame Returns the frame that has the supplied routingId.
getFrameForSelector(selector) ElectronWebFrame Returns the frame element in webFrame's document selected by selector.
getResourceUsage() ElectronResourceUsage Returns an object describing usage information of Blink's internal memory caches.
getWordSuggestions(word) string[] Returns a list of suggested words for a given word.
getZoomFactor() number Returns the current zoom factor.
getZoomLevel() number Returns the current zoom level.
insertCSS(css, options?) string Injects CSS into the current web page and returns a unique key for the inserted stylesheet.
insertText(text) void Inserts text into the focused element.
isWordMisspelled(word) boolean Returns whether the word is misspelled according to the built in spellchecker. If no dictionary is loaded, always returns false.
removeInsertedCSS(key) void Removes the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from insertCSS(css).
setIsolatedWorldInfo(worldId, info) void Sets the security origin, content security policy and name of the isolated world. If the csp is specified, then the securityOrigin also has to be specified.
setSpellCheckProvider(language, provider) void Sets a provider for spell checking in input fields and text areas. If you want to use this method you must disable the builtin spellchecker when you construct the window.
setVisualZoomLevelLimits(minimumLevel, maximumLevel) void Sets the maximum and minimum pinch-to-zoom level. Visual zoom is disabled by default in Electron.
setZoomFactor(factor) void 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.
setZoomLevel(level) void 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.

Links to this page: