콘텐츠로 이동

WebviewWindowOptions

이 콘텐츠는 아직 번역되지 않았습니다.

Module @netwiv/api/webviewWindow · Kind Type

import { WebviewWindowOptions } from '@netwiv/api/webviewWindow';
acceptFirstMouse?: boolean | undefined

Whether clicking an inactive webview also clicks through to the webview on macOS.

allowLinkPreview?: boolean | undefined

on 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?: boolean | undefined

Whether the window should always be below other windows.

alwaysOnTop?: boolean | undefined

Whether the window should always be on top of other windows or not.

backgroundColor?: Color | undefined

Set the window and webview background color.

  • 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.
  • Android / iOS: Unsupported.
  • Windows: alpha channel is ignored.
backgroundThrottling?: BackgroundThrottlingPolicy | undefined

Change 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.

  • 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.

  • 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?: boolean | undefined

Show window in the center of the screen..

closable?: boolean | undefined

Whether the window’s native close button is enabled or not. Defaults to true.

contentProtected?: boolean | undefined

Prevents the window contents from being captured by other apps.

dataDirectory?: string | undefined

Set 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.

  • Windows: WebViews with different values for settings like additionalBrowserArgs, browserExtensionsEnabled or scrollBarStyle must have different data directories.
  • macOS / iOS: Unsupported, use dataStoreIdentifier instead.
  • Android: Unsupported.
dataStoreIdentifier?: number[] | undefined

Initialize 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.

  • macOS / iOS: Available on macOS >= 14 and iOS >= 17
  • Windows / Linux / Android: Unsupported.
decorations?: boolean | undefined

Whether the window should have borders and bars or not.

devtools?: boolean | undefined

Whether 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.

  • macOS: This will call private functions on macOS.
  • Android: Open chrome://inspect/#devices in Chrome to get the devtools window. Wry’s WebView devtools API isn’t supported on Android.
  • iOS: Open Safari > Develop > [Your Device Name] > [Your WebView] to get the devtools window.
dragDropEnabled?: boolean | undefined

Whether 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?: boolean | undefined

Whether the webview should have focus or not Whether the window will be initially focused or not.

focusable?: boolean | undefined

Whether the window can be focused or not.

fullscreen?: boolean | undefined

Whether the window is in fullscreen mode or not.

generalAutofillEnabled?: boolean | undefined

Controls 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.

  • 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?: number | undefined

The initial height in logical pixels.

hiddenTitle?: boolean | undefined

If true, sets the window title to be hidden on macOS.

incognito?: boolean | undefined

Whether or not the webview should be launched in incognito mode.

  • Android: Unsupported.
javascriptDisabled?: boolean | undefined

Whether we should disable JavaScript code execution on the webview or not.

maxHeight?: number | undefined

The maximum height in logical pixels. Only applies if maxWidth is also set.

maximizable?: boolean | undefined

Whether the window’s native maximize button is enabled or not. Defaults to true.

maximized?: boolean | undefined

Whether the window should be maximized upon creation or not.

maxWidth?: number | undefined

The maximum width in logical pixels. Only applies if maxHeight is also set.

minHeight?: number | undefined

The minimum height in logical pixels. Only applies if minWidth is also set.

minimizable?: boolean | undefined

Whether the window’s native minimize button is enabled or not. Defaults to true.

minWidth?: number | undefined

The minimum width in logical pixels. Only applies if minHeight is also set.

parent?: string | Window | WebviewWindow | undefined
preventOverflow?: boolean | PreventOverflowMargin | undefined

Prevent 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

  • iOS / Android: Unsupported.
proxyUrl?: string | undefined

The proxy URL for the WebView for all network requests.

Must be either a http:// or a socks5:// URL.

  • macOS: Requires the macos-proxy feature flag and only compiles for macOS 14+.
resizable?: boolean | undefined

Whether the window is resizable or not.

scrollBarStyle?: ScrollBarStyle | undefined

Specifies 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.

  • Windows:
    • fluentOverlay requires 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 Default and performs no operation.
shadow?: boolean | undefined

Whether or not the window has shadow.

  • Windows:
  • false has no effect on decorated window, shadows are always ON.
  • true will make undecorated window have a 1px white border, and on Windows 11, it will have a rounded corners.
  • Linux: Unsupported.
skipTaskbar?: boolean | undefined

Whether or not the window icon should be added to the taskbar.

tabbingIdentifier?: string | undefined

Defines 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?: Theme | undefined

The initial window theme. Defaults to the system theme.

Only implemented on Windows and macOS 10.14+.

title?: string | undefined

Window title.

titleBarStyle?: TitleBarStyle | undefined

The style of the macOS title bar.

trafficLightPosition?: LogicalPosition | undefined

The position of the window controls on macOS.

Requires titleBarStyle: 'overlay' and decorations: true.

transparent?: boolean | undefined

Whether 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 | undefined

Remote URL or local file path to open.

  • URL such as https://github.com/tauri-apps is opened directly on a Tauri webview.
  • data: URL such as data:text/html,<html>... is only supported with the webview-data-url Cargo feature for the tauri dependency.
  • local file path or route such as /path/to/page.html or /users is appended to the application URL (the devServer URL on development, or tauri://localhost/ and https://tauri.localhost/ on production).
useHttpsScheme?: boolean | undefined

Sets 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.

Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access them.

userAgent?: string | undefined

The user agent for the webview.

visible?: boolean | undefined

Whether the window should be immediately visible upon creation or not.

visibleOnAllWorkspaces?: boolean | undefined

Whether the window should be visible on all workspaces or virtual desktops.

  • Windows / iOS / Android: Unsupported.
width?: number | undefined

The initial width in logical pixels.

windowEffects?: Effects | undefined

Window effects.

Requires the window to be transparent.

x?: number | undefined

The initial vertical position in logical pixels. Only applies if y is also set.

y?: number | undefined

The initial horizontal position in logical pixels. Only applies if x is also set.

zoomHotkeysEnabled?: boolean | undefined

Whether page zooming by hotkeys is enabled

  • Windows: Controls WebView2’s IsZoomControlEnabled setting.

  • MacOS / Linux: Injects a polyfill that zooms in and out with ctrl/command + -/=, 20% in each step, ranging from 20% to 1000%. Requires webview:allow-set-webview-zoom permission

  • 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®는 The Tauri Programme within the Commons Conservancy의 상표입니다. NetWiv는 독립 프로젝트이며 해당 단체와 제휴하거나 보증을 받지 않았습니다.