pub fn open<P: AsRef<str>>(
scope: &OpenScope,
path: P,
with: Option<Program>,
) -> Result<(), Error>
Expand description
Opens path or URL with the program specified in with
, or system default if None
.
The path will be matched against the shell open validation regex, defaulting to ^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+
.
A custom validation regex may be supplied in the config in plugins > shell > scope > open
.
ยงExamples
use tauri_plugin_shell::ShellExt;
tauri::Builder::default()
.setup(|app| {
// open the given URL on the system default browser
app.shell().open("https://github.com/tauri-apps/tauri", None)?;
Ok(())
});