Function webbrowser::open

source ·
pub fn open(url: &str) -> Result<()>
Expand description

Opens the URL on the default browser of this platform

Returns Ok(..) so long as the browser invocation was successful. An Err(..) is returned in the following scenarios:

  • The requested browser was not found
  • There was an error in opening the browser
  • hardened feature is enabled, and the URL was not a valid http(s) url, say a file:///
  • On ios/android/wasm, if the url is not a valid http(s) url

Equivalent to:

open_browser(Browser::Default, url);

Examples

use webbrowser;

if webbrowser::open("http://github.com").is_ok() {
    // ...
}