WebviewWindowOptions
Module @netwiv/api/webviewWindow · Kind Type
import { WebviewWindowOptions } from '@netwiv/api/webviewWindow';Members
Section titled “Members”acceptFirstMouse?
Section titled “acceptFirstMouse?”acceptFirstMouse?: boolean | undefinedWhether clicking an inactive webview also clicks through to the webview on macOS.
allowLinkPreview?
Section titled “allowLinkPreview?”allowLinkPreview?: boolean | undefinedon macOS and iOS there is a link preview on long pressing links, this is enabled by default. see https://docs.rs/objc2-web-kit/latest/objc2_web_kit/struct.WKWebView.html#method.allowsLinkPreview
alwaysOnBottom?
Section titled “alwaysOnBottom?”alwaysOnBottom?: boolean | undefinedWhether the window should always be below other windows.
alwaysOnTop?
Section titled “alwaysOnTop?”alwaysOnTop?: boolean | undefinedWhether the window should always be on top of other windows or not.
backgroundColor?
Section titled “backgroundColor?”backgroundColor?: Color | undefinedSet the window and webview background color.
Platform-specific:
Section titled “Platform-specific:”- macOS / iOS: Not implemented.
- Windows:
- On Windows 7, alpha channel is ignored.
- On Windows 8 and newer, if alpha channel is not
0, it will be ignored. Set the window background color.
Platform-specific:
Section titled “Platform-specific:”- Android / iOS: Unsupported.
- Windows: alpha channel is ignored.
backgroundThrottling?
Section titled “backgroundThrottling?”backgroundThrottling?: BackgroundThrottlingPolicy | undefinedChange the default background throttling behaviour.
By default, browsers use a suspend policy that will throttle timers and even unload the whole tab (view) to free resources after roughly 5 minutes when a view became minimized or hidden. This will pause all tasks until the documents visibility state changes back from hidden to visible by bringing the view back to the foreground.
Platform-specific
Section titled “Platform-specific”- Linux / Windows / Android: Unsupported. Workarounds like a pending WebLock transaction might suffice.
- iOS: Supported since version 17.0+.
- macOS: Supported since version 14.0+.
see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578 Change the default background throttling behaviour.
Platform-specific
Section titled “Platform-specific”- Linux / Windows / Android: Unsupported. Workarounds like a pending WebLock transaction might suffice.
- iOS: Supported since version 17.0+.
- macOS: Supported since version 14.0+.
see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578
center?
Section titled “center?”center?: boolean | undefinedShow window in the center of the screen..
closable?
Section titled “closable?”closable?: boolean | undefinedWhether the window’s native close button is enabled or not. Defaults to true.
contentProtected?
Section titled “contentProtected?”contentProtected?: boolean | undefinedPrevents the window contents from being captured by other apps.
dataDirectory?
Section titled “dataDirectory?”dataDirectory?: string | undefinedSet a custom path for the webview’s data directory (localStorage, cache, etc.) relative to [appDataDir()]/${label}.
For security reasons, paths outside of that location can only be configured on the Rust side.
Platform-specific:
Section titled “Platform-specific:”- Windows: WebViews with different values for settings like
additionalBrowserArgs,browserExtensionsEnabledorscrollBarStylemust have different data directories. - macOS / iOS: Unsupported, use
dataStoreIdentifierinstead. - Android: Unsupported.
dataStoreIdentifier?
Section titled “dataStoreIdentifier?”dataStoreIdentifier?: number[] | undefinedInitialize the WebView with a custom data store identifier. This can be seen as a replacement for dataDirectory which is unavailable in WKWebView.
See https://developer.apple.com/documentation/webkit/wkwebsitedatastore/init(foridentifier:)?language=objc
The array must contain 16 u8 numbers.
Platform-specific:
Section titled “Platform-specific:”- macOS / iOS: Available on macOS >= 14 and iOS >= 17
- Windows / Linux / Android: Unsupported.
decorations?
Section titled “decorations?”decorations?: boolean | undefinedWhether the window should have borders and bars or not.
devtools?
Section titled “devtools?”devtools?: boolean | undefinedWhether web inspector, which is usually called browser devtools, is enabled or not. Enabled by default.
This API works in debug builds, but requires devtools feature flag to enable it in release builds.
Platform-specific
Section titled “Platform-specific”- macOS: This will call private functions on macOS.
- Android: Open
chrome://inspect/#devicesin Chrome to get the devtools window. Wry’sWebViewdevtools API isn’t supported on Android. - iOS: Open Safari > Develop > [Your Device Name] > [Your WebView] to get the devtools window.
dragDropEnabled?
Section titled “dragDropEnabled?”dragDropEnabled?: boolean | undefinedWhether the drag and drop is enabled or not on the webview. By default it is enabled.
Disabling it is required to use HTML5 drag and drop on the frontend on Windows.
focus?
Section titled “focus?”focus?: boolean | undefinedWhether the webview should have focus or not Whether the window will be initially focused or not.
focusable?
Section titled “focusable?”focusable?: boolean | undefinedWhether the window can be focused or not.
fullscreen?
Section titled “fullscreen?”fullscreen?: boolean | undefinedWhether the window is in fullscreen mode or not.
generalAutofillEnabled?
Section titled “generalAutofillEnabled?”generalAutofillEnabled?: boolean | undefinedControls the WebView’s browser-level general autofill behavior.
This option does not disable password or credit card autofill.
When set to false, the WebView will not automatically populate general form
fields using previously stored data such as addresses or contact information.
If not specified, this is true by default.
Platform-specific
Section titled “Platform-specific”- Windows: Supported. WebView2’s autofill feature (called “Suggestions”)
may not honor
autocomplete="off"on input elements in some cases. - Linux / Android / iOS / macOS: Unsupported and performs no operation.
height?
Section titled “height?”height?: number | undefinedThe initial height in logical pixels.
hiddenTitle?
Section titled “hiddenTitle?”hiddenTitle?: boolean | undefinedIf true, sets the window title to be hidden on macOS.
incognito?
Section titled “incognito?”incognito?: boolean | undefinedWhether or not the webview should be launched in incognito mode.
Platform-specific
Section titled “Platform-specific”- Android: Unsupported.
javascriptDisabled?
Section titled “javascriptDisabled?”javascriptDisabled?: boolean | undefinedWhether we should disable JavaScript code execution on the webview or not.
maxHeight?
Section titled “maxHeight?”maxHeight?: number | undefinedThe maximum height in logical pixels. Only applies if maxWidth is also set.
maximizable?
Section titled “maximizable?”maximizable?: boolean | undefinedWhether the window’s native maximize button is enabled or not. Defaults to true.
maximized?
Section titled “maximized?”maximized?: boolean | undefinedWhether the window should be maximized upon creation or not.
maxWidth?
Section titled “maxWidth?”maxWidth?: number | undefinedThe maximum width in logical pixels. Only applies if maxHeight is also set.
minHeight?
Section titled “minHeight?”minHeight?: number | undefinedThe minimum height in logical pixels. Only applies if minWidth is also set.
minimizable?
Section titled “minimizable?”minimizable?: boolean | undefinedWhether the window’s native minimize button is enabled or not. Defaults to true.
minWidth?
Section titled “minWidth?”minWidth?: number | undefinedThe minimum width in logical pixels. Only applies if minHeight is also set.
parent?
Section titled “parent?”parent?: string | Window | WebviewWindow | undefinedpreventOverflow?
Section titled “preventOverflow?”preventOverflow?: boolean | PreventOverflowMargin | undefinedPrevent the window from overflowing the working area (e.g. monitor size - taskbar size)
on creation, which means the window size will be limited to monitor size - taskbar size
Can either be set to true or to a {@link PreventOverflowMargin} object to set an additional margin
that should be considered to determine the working area
(in this case the window size will be limited to monitor size - taskbar size - margin)
NOTE: The overflow check is only performed on window creation, resizes can still overflow
Platform-specific
Section titled “Platform-specific”- iOS / Android: Unsupported.
proxyUrl?
Section titled “proxyUrl?”proxyUrl?: string | undefinedThe proxy URL for the WebView for all network requests.
Must be either a http:// or a socks5:// URL.
Platform-specific
Section titled “Platform-specific”- macOS: Requires the
macos-proxyfeature flag and only compiles for macOS 14+.
resizable?
Section titled “resizable?”resizable?: boolean | undefinedWhether the window is resizable or not.
scrollBarStyle?
Section titled “scrollBarStyle?”scrollBarStyle?: ScrollBarStyle | undefinedSpecifies the native scrollbar style to use with the webview. CSS styles that modify the scrollbar are applied on top of the native appearance configured here.
Defaults to default, which is the browser default.
Platform-specific
Section titled “Platform-specific”- Windows:
fluentOverlayrequires WebView2 Runtime version 125.0.2535.41 or higher, and does nothing on older versions.- This option must be given the same value for all webviews.
- Linux / Android / iOS / macOS: Unsupported. Only supports
Defaultand performs no operation.
shadow?
Section titled “shadow?”shadow?: boolean | undefinedWhether or not the window has shadow.
Platform-specific
Section titled “Platform-specific”- Windows:
falsehas no effect on decorated window, shadows are always ON.truewill make undecorated window have a 1px white border, and on Windows 11, it will have a rounded corners.- Linux: Unsupported.
skipTaskbar?
Section titled “skipTaskbar?”skipTaskbar?: boolean | undefinedWhether or not the window icon should be added to the taskbar.
tabbingIdentifier?
Section titled “tabbingIdentifier?”tabbingIdentifier?: string | undefinedDefines the window tabbing identifier on macOS.
Windows with the same tabbing identifier will be grouped together. If the tabbing identifier is not set, automatic tabbing will be disabled.
theme?
Section titled “theme?”theme?: Theme | undefinedThe initial window theme. Defaults to the system theme.
Only implemented on Windows and macOS 10.14+.
title?
Section titled “title?”title?: string | undefinedWindow title.
titleBarStyle?
Section titled “titleBarStyle?”titleBarStyle?: TitleBarStyle | undefinedThe style of the macOS title bar.
trafficLightPosition?
Section titled “trafficLightPosition?”trafficLightPosition?: LogicalPosition | undefinedThe position of the window controls on macOS.
Requires titleBarStyle: 'overlay' and decorations: true.
transparent?
Section titled “transparent?”transparent?: boolean | undefinedWhether the webview is transparent or not.
Note that on macOS this requires the macos-private-api feature flag, enabled under tauri.conf.json > app > macOSPrivateApi.
WARNING: Using private APIs on macOS prevents your application from being accepted to the App Store.
Whether the window is transparent or not.
Note that on macOS this requires the macos-private-api feature flag, enabled under tauri.conf.json > app > macOSPrivateApi.
WARNING: Using private APIs on macOS prevents your application from being accepted to the App Store.
url?: string | undefinedRemote URL or local file path to open.
- URL such as
https://github.com/tauri-appsis opened directly on a Tauri webview. - data: URL such as
data:text/html,<html>...is only supported with thewebview-data-urlCargo feature for thetauridependency. - local file path or route such as
/path/to/page.htmlor/usersis appended to the application URL (the devServer URL on development, ortauri://localhost/andhttps://tauri.localhost/on production).
useHttpsScheme?
Section titled “useHttpsScheme?”useHttpsScheme?: boolean | undefinedSets whether the custom protocols should use https://<scheme>.localhost instead of the default http://<scheme>.localhost on Windows and Android. Defaults to false.
Using a https scheme will NOT allow mixed content when trying to fetch http endpoints and therefore will not match the behavior of the <scheme>://localhost protocols used on macOS and Linux.
Warning
Section titled “Warning”Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access them.
userAgent?
Section titled “userAgent?”userAgent?: string | undefinedThe user agent for the webview.
visible?
Section titled “visible?”visible?: boolean | undefinedWhether the window should be immediately visible upon creation or not.
visibleOnAllWorkspaces?
Section titled “visibleOnAllWorkspaces?”visibleOnAllWorkspaces?: boolean | undefinedWhether the window should be visible on all workspaces or virtual desktops.
Platform-specific
Section titled “Platform-specific”- Windows / iOS / Android: Unsupported.
width?
Section titled “width?”width?: number | undefinedThe initial width in logical pixels.
windowEffects?
Section titled “windowEffects?”windowEffects?: Effects | undefinedWindow effects.
Requires the window to be transparent.
Platform-specific:
Section titled “Platform-specific:”- Windows: If using decorations or shadows, you may want to try this workaround https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891
- Linux: Unsupported
x?: number | undefinedThe initial vertical position in logical pixels. Only applies if y is also set.
y?: number | undefinedThe initial horizontal position in logical pixels. Only applies if x is also set.
zoomHotkeysEnabled?
Section titled “zoomHotkeysEnabled?”zoomHotkeysEnabled?: boolean | undefinedWhether page zooming by hotkeys is enabled
Platform-specific:
Section titled “Platform-specific:”-
Windows: Controls WebView2’s
IsZoomControlEnabledsetting. -
MacOS / Linux: Injects a polyfill that zooms in and out with
ctrl/command+-/=, 20% in each step, ranging from 20% to 1000%. Requireswebview:allow-set-webview-zoompermission -
Android / iOS: Unsupported.
Descriptions come from the pinned @tauri-apps/api@2.11.1 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.
TAURI® is a trademark of The Tauri Programme within the Commons Conservancy. NetWiv is an independent project, not affiliated with or endorsed by it.