Skip to content

WebPreferences

Unofficial

Web preferences for configuring Electron web content behavior.

Import:

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

Signature:

export interface WebPreferences

Properties

PropertyTypeDescription
accessibleTitle?stringAn alternative title string provided only to accessibility tools such as screen readers. This string is not directly visible to users.
additionalArguments?string[]A list of strings that will be appended to process.argv in the renderer process of this app. Useful for passing small bits of data down to renderer process preload scripts.
allowRunningInsecureContent?booleanAllow an https page to run JavaScript, CSS or plugins from http URLs.
autoplayPolicy?'document-user-activation-required' | 'no-user-gesture-required' | 'user-gesture-required'Autoplay policy to apply to content in the window.
backgroundThrottling?booleanWhether to throttle animations and timers when the page becomes background. This also affects the Page Visibility API.
contextIsolation?booleanWhether to run Electron APIs and the specified preload script in a separate JavaScript context.
defaultEncoding?stringThe default text encoding.
defaultFontFamily?ElectronDefaultFontFamilySets the default font for the font-family.
defaultFontSize?numberThe default font size in pixels.
defaultMonospaceFontSize?numberThe default monospace font size in pixels.
devTools?booleanWhether to enable DevTools. If it is set to false, BrowserWindow.webContents.openDevTools() cannot be used to open DevTools.
disableBlinkFeatures?stringA list of feature strings separated by , to disable. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file.
disableDialogs?booleanWhether to disable dialogs completely. Overrides safeDialogs.
disableHtmlFullscreenWindowResize?booleanWhether to prevent the window from resizing when entering HTML Fullscreen.
enableBlinkFeatures?stringA list of feature strings separated by , to enable. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file.
enablePreferredSizeMode?booleanWhether to enable preferred size mode. Enabling this causes the preferred-size-changed event to be emitted on the WebContents when the preferred size changes.
enableWebSQL?booleanWhether to enable the WebSQL api.
experimentalFeatures?booleanEnables Chromium's experimental features.
imageAnimationPolicy?'animate' | 'animateOnce' | 'noAnimation'Specifies how to run image animations (e.g. GIFs).
images?booleanEnables image support.
javascript?booleanEnables JavaScript support.
minimumFontSize?numberThe minimum font size in pixels.
navigateOnDragDrop?booleanWhether dragging and dropping a file or link onto the page causes a navigation.
nodeIntegration?booleanWhether node integration is enabled.
nodeIntegrationInSubFrames?booleanExperimental option for enabling Node.js support in sub-frames such as iframes and child windows. All preloads will load for every iframe; process.isMainFrame can be used to determine if in the main frame or not.
nodeIntegrationInWorker?booleanWhether node integration is enabled in web workers.
offscreen?booleanWhether to enable offscreen rendering for the browser window.
partition?stringSets the session used by the page according to the session's partition string. 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.
plugins?booleanWhether plugins should be enabled.
preload?stringSpecifies a script that will be loaded before other scripts run in the page. The value should be the absolute file path to the script.
safeDialogs?booleanWhether to enable browser style consecutive dialog protection.
safeDialogsMessage?stringThe message to display when consecutive dialog protection is triggered. If not defined the default message would be used.
sandbox?booleanIf set, this will sandbox the renderer associated with the window, making it compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
scrollBounce?booleanEnables scroll bounce (rubber banding) effect on macOS.
session?SessionSets the session used by the page. When both session and partition are provided, session will be preferred.
spellcheck?booleanWhether to enable the builtin spellchecker.
textAreasAreResizable?booleanMake TextArea elements resizable.
v8CacheOptions?'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile' | 'code' | 'none'Enforces the v8 code caching policy used by blink.
webgl?booleanEnables WebGL support.
webSecurity?booleanWhen false, it will disable the same-origin policy, and set allowRunningInsecureContent to true if this option has not been set by the user.
webviewTag?booleanWhether to enable the <webview> tag.
zoomFactor?numberThe default zoom factor of the page, 3.0 represents 300%.

Links to this page: