#tauri-plugin #url #browser #default #blank #target #openurl

sys tauri-plugin-openurl

open url in default browser (just like target blank) in Tauri

5 releases

0.1.0 Oct 8, 2024
0.1.0-beta.4 Aug 2, 2024
0.1.0-beta.3 Apr 24, 2024
0.1.0-beta.2 Apr 9, 2024
0.1.0-beta.1 Apr 8, 2024

#702 in GUI

44 downloads per month

MIT license

20KB
305 lines

Crates.io Version Crates.io Total Downloads NPM Version NPM Downloads

Tauri Plugin openurl

Open url in browser on all platforms1 (excluding IOS, still in testing). Basically <a target="_blank"></a> replacement for all platforms1.

Usage

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.

Setup

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

Usage

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>

Permissions

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.

Dependencies

~18–62MB
~890K SLoC