File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -81,14 +81,16 @@ The opener plugin is available in both JavaScript and Rust.
8181 <TabItem label = " JavaScript" >
8282
8383``` javascript
84- import { openPath } from ' @tauri-apps/plugin-opener' ;
84+ import { openPath , openUrl } from ' @tauri-apps/plugin-opener' ;
8585// when using `"withGlobalTauri": true`, you may use
8686// const { openPath } = window.__TAURI__.opener;
8787
8888// opens a file using the default program:
8989await openPath (' /path/to/file' );
9090// opens a file using `vlc` command on Windows:
9191await openPath (' C:/path/to/file' , ' vlc' );
92+ // opens a URL using the default program:
93+ await openURL (' https://tauri.app' );
9294```
9395
9496 </TabItem >
@@ -103,6 +105,8 @@ use tauri_plugin_opener::OpenerExt;
103105app . opener (). open_path (" /path/to/file" , None :: <& str >);
104106// opens a file using `vlc` command on Windows:
105107app . opener (). open_path (" C:/path/to/file" , Some (" vlc" ));
108+ // opens a URL using the default program:
109+ app . opener (). open_url (" https://tauri.app" , None :: <& str >);
106110```
107111
108112 </TabItem >
You can’t perform that action at this time.
0 commit comments