Update: This project is replaced by Official Tauri Plugin. For more details Tauri Opener
Open url in browser on all platforms1 (excluding IOS, still in testing). Basically <a target="_blank"></a> replacement for all platforms1.
This plugin is still part of Tauri V2 Beta. So, this project might be replaced by a fix in Tauri core itself before project is stable.
npm
npm i tauri-plugin-openurl-api&& cargo (possibly inside ./src-tauri/)
cargo add tauri-plugin-openurlalso add this to your tauri builder
tauri::Builder::default()
// other plugins
.plugin(tauri_plugin_openurl::init())
// rest of the builderimport { open_url } from "tauri-plugin-openurl-api";
<button onClick={() => {
open_url("https://crates.io/crates/tauri-plugin-openurl");
}}>Click to open in default browser</button>Please make sure you add this permission to all platforms you intend to use in
{
"permissions": [
"openurl:allow-open-url"
]
}References:
1 : excluding IOS as it is still in testing.