You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/tauri-cli/config.schema.json
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -572,6 +572,27 @@
572
572
"description": "Allows disabling the input accessory view on iOS.\n\n The accessory view is the view that appears above the keyboard when a text input element is focused.\n It usually displays a view with \"Done\", \"Next\" buttons.",
573
573
"default": false,
574
574
"type": "boolean"
575
+
},
576
+
"dataDirectory": {
577
+
"description": "Set a custom path for the webview's data directory (localStorage, cache, etc.) **relative to [`appDataDir()`]/${label}**.\n\n To set absolute paths, use [`WebviewWindowBuilder::data_directory`](https://docs.rs/tauri/2/tauri/webview/struct.WebviewWindowBuilder.html#method.data_directory)\n\n #### Platform-specific:\n\n - **Windows**: WebViews with different values for settings like `additionalBrowserArgs`, `browserExtensionsEnabled` or `scrollBarStyle` must have different data directories.\n - **macOS / iOS**: Unsupported, use `dataStoreIdentifier` instead.\n - **Android**: Unsupported.",
578
+
"type": [
579
+
"string",
580
+
"null"
581
+
]
582
+
},
583
+
"dataStoreIdentifier": {
584
+
"description": "Initialize the WebView with a custom data store identifier. This can be seen as a replacement for `dataDirectory` which is unavailable in WKWebView.\n See https://developer.apple.com/documentation/webkit/wkwebsitedatastore/init(foridentifier:)?language=objc\n\n The array must contain 16 u8 numbers.\n\n #### Platform-specific:\n\n - **iOS**: Supported since version 17.0+.\n - **macOS**: Supported since version 14.0+.\n - **Windows / Linux / Android**: Unsupported.",
Copy file name to clipboardExpand all lines: crates/tauri-schema-generator/schemas/config.schema.json
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -572,6 +572,27 @@
572
572
"description": "Allows disabling the input accessory view on iOS.\n\n The accessory view is the view that appears above the keyboard when a text input element is focused.\n It usually displays a view with \"Done\", \"Next\" buttons.",
573
573
"default": false,
574
574
"type": "boolean"
575
+
},
576
+
"dataDirectory": {
577
+
"description": "Set a custom path for the webview's data directory (localStorage, cache, etc.) **relative to [`appDataDir()`]/${label}**.\n\n To set absolute paths, use [`WebviewWindowBuilder::data_directory`](https://docs.rs/tauri/2/tauri/webview/struct.WebviewWindowBuilder.html#method.data_directory)\n\n #### Platform-specific:\n\n - **Windows**: WebViews with different values for settings like `additionalBrowserArgs`, `browserExtensionsEnabled` or `scrollBarStyle` must have different data directories.\n - **macOS / iOS**: Unsupported, use `dataStoreIdentifier` instead.\n - **Android**: Unsupported.",
578
+
"type": [
579
+
"string",
580
+
"null"
581
+
]
582
+
},
583
+
"dataStoreIdentifier": {
584
+
"description": "Initialize the WebView with a custom data store identifier. This can be seen as a replacement for `dataDirectory` which is unavailable in WKWebView.\n See https://developer.apple.com/documentation/webkit/wkwebsitedatastore/init(foridentifier:)?language=objc\n\n The array must contain 16 u8 numbers.\n\n #### Platform-specific:\n\n - **iOS**: Supported since version 17.0+.\n - **macOS**: Supported since version 14.0+.\n - **Windows / Linux / Android**: Unsupported.",
Copy file name to clipboardExpand all lines: crates/tauri-utils/src/config.rs
+32-1Lines changed: 32 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1894,6 +1894,31 @@ pub struct WindowConfig {
1894
1894
alias = "disable_input_accessory_view"
1895
1895
)]
1896
1896
pubdisable_input_accessory_view:bool,
1897
+
///
1898
+
/// Set a custom path for the webview's data directory (localStorage, cache, etc.) **relative to [`appDataDir()`]/${label}**.
1899
+
///
1900
+
/// To set absolute paths, use [`WebviewWindowBuilder::data_directory`](https://docs.rs/tauri/2/tauri/webview/struct.WebviewWindowBuilder.html#method.data_directory)
1901
+
///
1902
+
/// #### Platform-specific:
1903
+
///
1904
+
/// - **Windows**: WebViews with different values for settings like `additionalBrowserArgs`, `browserExtensionsEnabled` or `scrollBarStyle` must have different data directories.
1905
+
/// - **macOS / iOS**: Unsupported, use `dataStoreIdentifier` instead.
1906
+
/// - **Android**: Unsupported.
1907
+
#[serde(default, alias = "data-directory")]
1908
+
pubdata_directory:Option<PathBuf>,
1909
+
///
1910
+
/// Initialize the WebView with a custom data store identifier. This can be seen as a replacement for `dataDirectory` which is unavailable in WKWebView.
1911
+
/// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore/init(foridentifier:)?language=objc
1912
+
///
1913
+
/// The array must contain 16 u8 numbers.
1914
+
///
1915
+
/// #### Platform-specific:
1916
+
///
1917
+
/// - **iOS**: Supported since version 17.0+.
1918
+
/// - **macOS**: Supported since version 14.0+.
1919
+
/// - **Windows / Linux / Android**: Unsupported.
1920
+
#[serde(default, alias = "data-store-identifier")]
1921
+
pubdata_store_identifier:Option<[u8;16]>,
1897
1922
}
1898
1923
1899
1924
implDefaultforWindowConfig{
@@ -1953,6 +1978,8 @@ impl Default for WindowConfig {
1953
1978
javascript_disabled:false,
1954
1979
allow_link_preview:true,
1955
1980
disable_input_accessory_view:false,
1981
+
data_directory:None,
1982
+
data_store_identifier:None,
1956
1983
}
1957
1984
}
1958
1985
}
@@ -3459,6 +3486,8 @@ mod build {
3459
3486
let javascript_disabled = self.javascript_disabled;
3460
3487
let allow_link_preview = self.allow_link_preview;
3461
3488
let disable_input_accessory_view = self.disable_input_accessory_view;
3489
+
let data_directory = opt_lit(self.data_directory.as_ref().map(path_buf_lit).as_ref());
3490
+
let data_store_identifier = opt_vec_lit(self.data_store_identifier, identity);
Copy file name to clipboardExpand all lines: packages/api/src/webview.ts
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -854,6 +854,33 @@ interface WebviewOptions {
854
854
* It usually displays a view with "Done", "Next" buttons.
855
855
*/
856
856
disableInputAccessoryView?: boolean
857
+
/**
858
+
* Set a custom path for the webview's data directory (localStorage, cache, etc.) **relative to [`appDataDir()`]/${label}**.
859
+
* For security reasons, paths outside of that location can only be configured on the Rust side.
860
+
*
861
+
* #### Platform-specific:
862
+
*
863
+
* - **Windows**: WebViews with different values for settings like `additionalBrowserArgs`, `browserExtensionsEnabled` or `scrollBarStyle` must have different data directories.
864
+
* - **macOS / iOS**: Unsupported, use `dataStoreIdentifier` instead.
865
+
* - **Android**: Unsupported.
866
+
*
867
+
* @since 2.9.0
868
+
*/
869
+
dataDirectory?: string
870
+
/**
871
+
* Initialize the WebView with a custom data store identifier. This can be seen as a replacement for `dataDirectory` which is unavailable in WKWebView.
872
+
* See https://developer.apple.com/documentation/webkit/wkwebsitedatastore/init(foridentifier:)?language=objc
873
+
*
874
+
* The array must contain 16 u8 numbers.
875
+
*
876
+
* #### Platform-specific:
877
+
*
878
+
* - **macOS / iOS**: Available on macOS >= 14 and iOS >= 17
0 commit comments