Crate webbrowser

source ·
Expand description

Open URLs in the web browsers available on a platform.

Inspired by the webbrowser python library.

Currently state of platform support is:

  • macos => default, as well as browsers listed under Browser
  • windows => default browser only
  • linux => default browser only (uses $BROWSER env var, failing back to xdg-open, gvfs-open and gnome-open, in that order)
  • android => not supported right now
  • ios => not supported right now

Important note:

  • This library requires availability of browsers and a graphical environment during runtime
  • cargo test will actually open the browser locally.

Examples

use webbrowser;

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

Structs

The Error type for parsing a string into a Browser.

Enums

Browser types available

Functions

Opens the URL on the default browser of this platform
Opens the specified URL on the specific browser (if available) requested. Return semantics are the same as for open.