Compare commits

...

1 Commits

Author SHA1 Message Date
Tommy Verrall cdd9ec3622 fix double opening window 2025-04-30 10:50:07 +02:00
@@ -4,8 +4,21 @@ use tauri_plugin_opener::OpenerExt;
pub async fn open_url(url: String, app_handle: tauri::AppHandle) -> Result<(), String> {
println!("Opening URL: {}", url);
match app_handle.opener().open_url(&url, None::<&str>) {
Ok(_) => Ok(()),
Err(err) => Err(format!("Failed to open URL: {}", err)),
#[cfg(target_os = "windows")]
{
// Windows needs shell capability
match app_handle.shell().open("", &url) {
Ok(_) => Ok(()),
Err(err) => Err(format!("Failed to open URL: {}", err)),
}
}
#[cfg(not(target_os = "windows"))]
{
// macOS and Linux work well with opener
match app_handle.opener().open_url(&url, None::<&str>) {
Ok(_) => Ok(()),
Err(err) => Err(format!("Failed to open URL: {}", err)),
}
}
}