Skip to main content

open_url

Function open_url 

Source
pub fn open_url(url: &str) -> Result<()>
Expand description

Opens a URL with the user’s default browser or registered handler.

This function checks only that the input is non-empty after trimming whitespace. URL validation is otherwise delegated to the Windows shell.

§Errors

Returns Error::InvalidInput if url is empty or whitespace only. Returns Error::WindowsApi if ShellExecuteW reports failure.

Examples found in repository?
examples/open.rs (line 2)
1fn main() {
2    win_desktop_utils::open_url("https://www.rust-lang.org").unwrap();
3}