#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

#676 in GUI

Download history 82/week @ 2024-07-28 15/week @ 2024-08-04 8/week @ 2024-09-15 3/week @ 2024-09-22 11/week @ 2024-09-29 148/week @ 2024-10-06 10/week @ 2024-10-13

169 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

~17–58MB
~889K SLoC