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

PropertyTypeDescription
firstChildElectronWebFrame | nullThe first child frame of webFrame, or null if webFrame has no children or if the first child is not in the current renderer process.
nextSiblingElectronWebFrame | nullThe 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.
openerElectronWebFrame | nullThe frame which opened webFrame, or null if there is no opener or the opener is not in the current renderer process.
parentElectronWebFrame | nullThe parent frame of webFrame, or null if webFrame is top or the parent is not in the current renderer process.
routingIdnumberThe unique frame id in the current renderer process. Distinct WebFrame instances that refer to the same underlying frame will have the same routingId.
topElectronWebFrame | nullThe top frame in the frame hierarchy to which webFrame belongs, or null if the top frame is not in the current renderer process.

Methods

MethodReturnsDescription
clearCache()voidAttempts 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)ElectronWebFrameReturns a child of webFrame with the supplied name.
findFrameByRoutingId(routingId)ElectronWebFrameReturns the frame that has the supplied routingId.
getFrameForSelector(selector)ElectronWebFrameReturns the frame element in webFrame's document selected by selector.
getResourceUsage()ElectronResourceUsageReturns 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()numberReturns the current zoom factor.
getZoomLevel()numberReturns the current zoom level.
insertCSS(css, options?)stringInjects CSS into the current web page and returns a unique key for the inserted stylesheet.
insertText(text)voidInserts text into the focused element.
isWordMisspelled(word)booleanReturns whether the word is misspelled according to the built in spellchecker. If no dictionary is loaded, always returns false.
removeInsertedCSS(key)voidRemoves the inserted CSS from the current web page. The stylesheet is identified by its key, which is returned from insertCSS(css).
setIsolatedWorldInfo(worldId, info)voidSets 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)voidSets 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)voidSets the maximum and minimum pinch-to-zoom level. Visual zoom is disabled by default in Electron.
setZoomFactor(factor)voidChanges 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)voidChanges 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: