WebviewOptions
이 콘텐츠는 아직 번역되지 않았습니다.
Module @netwiv/api/webview · Kind Type
import { WebviewOptions } from '@netwiv/api/webview';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
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.
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
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.
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
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: numberThe initial height in logical pixels.
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.
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+.
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.
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.
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.
width: numberThe initial width in logical pixels.
x: numberThe initial vertical position in logical pixels.
y: numberThe initial horizontal position in logical pixels.
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®는 The Tauri Programme within the Commons Conservancy의 상표입니다. NetWiv는 독립 프로젝트이며 해당 단체와 제휴하거나 보증을 받지 않았습니다.