Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

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

License

Notifications You must be signed in to change notification settings

giripriyadarshan/tauri-plugin-openurl

Repository files navigation

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

Update: This project is replaced by Official Tauri Plugin. For more details Tauri Opener

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.

About

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

Resources

License

Stars

Watchers

Forks