Open chenrensong opened 3 months ago
I have encountered this issue as well.
Can one of you please post the output of the tauri info
command as required by the issue template?
And if you're on v2, do you have tauri's unstable
feature flag enabled or not? (if you don't know then the answer is probably no)
Similar issues.
import { WebviewWindow } from '@tauri-apps/api/webviewWindow'
import { getCurrent } from '@tauri-apps/api/window'
...
if(platform.value=='windows'){
options.parent = getCurrent();
}
const webview = new WebviewWindow(`${app.name}-webview`, options);
webview.once('tauri://created', function (d) {
console.log('tauri://created')
console.log(d)
// webview successfully created
});
webview.once('tauri://error', function (e) {
console.log('tauri://error')
console.log(e)
// an error happened creating the webview
});
...
[dependencies]
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs" }
tauri = { version = "=2.0.0-beta.22", features = ["macos-proxy", "unstable"] }
tauri-utils = "=2.0.0-beta.17"
tauri-plugin-shell = "=2.0.0-beta.5"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tauri-plugin-process = "=2.0.0-beta.5"
tauri-plugin-http = "=2.0.0-beta.5"
tauri-plugin-os = "=2.0.0-beta.5"
tauri-plugin-fs = "=2.0.0-beta.7"
tauri-plugin-deep-link = "=2.0.0-beta.6"
Whether in Win10/Win11, creating a window will crash, tauri://created It will happen, but there are no errors,
@lindongchen Does this also happen if you remove the unstable
flag?
@lindongchen Does this also happen if you remove the
unstable
flag?
error[E0599]: no method named add_child
found for struct tauri::Window
in the current scope
--> src\webview.rs:35:27
|
35 | let _webview = window.add_child(
| -------^^^^^^^^^ method not found in Window
error[E0599]: no method named add_child
found for struct tauri::Window
in the current scope
--> src\webview.rs:71:27
|
71 | let _webview = window.add_child(
| -------^^^^^^^^^ method not found in Window
error[E0599]: no method named get_webview
found for struct AppHandle
in the current scope
--> src\webview.rs:81:22
|
81 | match app_handle.get_webview(label) {
I have tracked the source code and found that many functions are enabled under the unstable flag, so removing the unstable flag seems meaningless @FabianLars
Apologies, i only looked at your js example and forgot about the initial issue code...
May I know which version can be fixed
The implementations behind the unstable
flag currently do not get much priority so i can't give you an ETA.
The implementations behind the
unstable
flag currently do not get much priority so i can't give you an ETA.
I have a very important project that relies on this feature. Can you help optimize it
No, sorry. I don't have any spare time myself.
One thing I just noticed though, did you ever try making your create_webview_inner
command async? That was already a requirement for webview/window creation on windows in v1 so maybe it's the issue here (though it should cause a deadlock, not a crash).
Check src-tauri/capabilities/desktop.json
for duplicate permissions. Duplicate permissions here will cause a stack overflow on windows - no idea why. Tested on Win10/11.
We had an extra notification:default
and it was just having a meltdown after it launched the webview.
double edit: these are now resolved with the closing of https://github.com/tauri-apps/plugins-workspace/issues/1254#event-13614101510 - perhaps they were both related? All appears to be good now.
Describe the bug
[tauri::command]
pub fn create_webview_inner( window: tauri::Window, url: String, x: f64, y: f64, width: f64, height: f64, ) -> Result<String, String> { let window_id = WINDOW_ID.fetchadd(1, atomic::Ordering::SeqCst); let label = format!("webview{}", window_id); let webview_builder = tauri::webview::WebviewBuilder::new(label.clone(), WebviewUrl::App(url.parse().unwrap())); let _webview = window.add_child( webview_builder.auto_resize(), LogicalPosition::new(x, y), LogicalSize::new(width, height), ); Ok(label) }
The above code can be allowed normally on Mac, but cannot be allowed on Windows
Reproduction
No response
Expected behavior
No response
Full
tauri info
outputStack trace
No response
Additional context
No response