webbrowser
Rust library to open URLs in the web browsers available on a platform
Inspired by the webbrowser python library
Documentation
Examples
use webbrowser;
if open.is_ok
Platform Support
Platform | Supported | Browsers | Test status |
---|---|---|---|
macos | ✅ | default + others | ✅ |
windows | ✅ | default only | ✅ |
linux/*bsd | ✅ | default only (respects $BROWSER env var, so can be used with other browsers) | ✅ |
android | ✅ | default only | ✅ |
wasm | ✅ | default only | ✅ |
haiku | ✅ (experimental) | default only | ❌ |
ios | ❌ | default only | ❌ |
Consistent Behaviour
webbrowser
defines consistent behaviour on all platforms as follows:
- Non-Blocking for GUI based browsers (e.g. Firefox, Chrome etc.), while Blocking for text based browser (e.g. lynx etc.)
- Suppressed output by default for GUI based browsers, so that their stdout/stderr don't pollute the main program's output. This can be overridden by
webbrowser::open_browser_with_options
.
Looking to contribute?
PRs invited for
- Support for other platforms, e.g. iOS
Important note (while testing):
- This library requires availability of browsers and a graphical environment during runtime
cargo test
will actually open the browser locally
When contributing, please note that your work will be dual licensed as MIT + Apache-2.0 (see below).
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.