Crates.io | tauri-plugin-openurl |
lib.rs | tauri-plugin-openurl |
version | 0.1.0 |
source | src |
created_at | 2024-04-08 15:51:28.331877 |
updated_at | 2024-10-08 16:36:20.270059 |
description | open url in default browser (just like target blank) in Tauri |
homepage | |
repository | |
max_upload_size | |
id | 1200489 |
size | 55,965 |
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-openurl
also add this to your tauri builder
tauri::Builder::default()
// other plugins
.plugin(tauri_plugin_openurl::init())
// rest of the builder
import { 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.