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

Property Type Description
accessibleTitle? string An 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? boolean Allow 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? boolean Whether to throttle animations and timers when the page becomes background. This also affects the Page Visibility API.
contextIsolation? boolean Whether to run Electron APIs and the specified preload script in a separate JavaScript context.
defaultEncoding? string The default text encoding.
defaultFontFamily? ElectronDefaultFontFamily Sets the default font for the font-family.
defaultFontSize? number The default font size in pixels.
defaultMonospaceFontSize? number The default monospace font size in pixels.
devTools? boolean Whether to enable DevTools. If it is set to false, BrowserWindow.webContents.openDevTools() cannot be used to open DevTools.
disableBlinkFeatures? string A list of feature strings separated by , to disable. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file.
disableDialogs? boolean Whether to disable dialogs completely. Overrides safeDialogs.
disableHtmlFullscreenWindowResize? boolean Whether to prevent the window from resizing when entering HTML Fullscreen.
enableBlinkFeatures? string A list of feature strings separated by , to enable. The full list of supported feature strings can be found in the RuntimeEnabledFeatures.json5 file.
enablePreferredSizeMode? boolean Whether 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? boolean Whether to enable the WebSQL api.
experimentalFeatures? boolean Enables Chromium's experimental features.
imageAnimationPolicy? 'animate' | 'animateOnce' | 'noAnimation' Specifies how to run image animations (e.g. GIFs).
images? boolean Enables image support.
javascript? boolean Enables JavaScript support.
minimumFontSize? number The minimum font size in pixels.
navigateOnDragDrop? boolean Whether dragging and dropping a file or link onto the page causes a navigation.
nodeIntegration? boolean Whether node integration is enabled.
nodeIntegrationInSubFrames? boolean Experimental 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? boolean Whether node integration is enabled in web workers.
offscreen? boolean Whether to enable offscreen rendering for the browser window.
partition? string Sets 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? boolean Whether plugins should be enabled.
preload? string Specifies 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? boolean Whether to enable browser style consecutive dialog protection.
safeDialogsMessage? string The message to display when consecutive dialog protection is triggered. If not defined the default message would be used.
sandbox? boolean If 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? boolean Enables scroll bounce (rubber banding) effect on macOS.
session? Session Sets the session used by the page. When both session and partition are provided, session will be preferred.
spellcheck? boolean Whether to enable the builtin spellchecker.
textAreasAreResizable? boolean Make TextArea elements resizable.
v8CacheOptions? 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile' | 'code' | 'none' Enforces the v8 code caching policy used by blink.
webgl? boolean Enables WebGL support.
webSecurity? boolean When false, it will disable the same-origin policy, and set allowRunningInsecureContent to true if this option has not been set by the user.
webviewTag? boolean Whether to enable the <webview> tag.
zoomFactor? number The default zoom factor of the page, 3.0 represents 300%.

Links to this page: