Skip to main content

launch_default_browser

Function launch_default_browser 

Source
pub fn launch_default_browser(url: &str, flags: BrowserLaunchFlags) -> bool
Expand description

Opens the given URL in the default browser.

Returns true if the browser was successfully launched, false otherwise.

§Arguments

  • url - The URL to open (can be a web address or a file:// URL).

§Example

use wxdragon::utils::{launch_default_browser, BrowserLaunchFlags};

// Open a web page
if launch_default_browser("https://www.example.com", BrowserLaunchFlags::Default) {
    println!("Browser launched successfully");
}

// Open in a new window (if supported by the browser)
launch_default_browser("https://www.rust-lang.org", BrowserLaunchFlags::NewWindow);