Crates.io | webbrowser |
lib.rs | webbrowser |
version | |
source | src |
created_at | 2015-12-08 20:44:31.348263 |
updated_at | 2024-11-28 17:18:47.780394 |
description | Open URLs in web browsers available on a platform |
homepage | https://github.com/amodm/webbrowser-rs |
repository | https://github.com/amodm/webbrowser-rs |
max_upload_size | |
id | 3597 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Rust library to open URLs and local files in the web browsers available on a platform, with guarantees of Consistent Behaviour.
Inspired by the webbrowser python library
use webbrowser;
if webbrowser::open("http://github.com").is_ok() {
// ...
}
Platform | Supported | Browsers | Test status |
---|---|---|---|
macos | ✅ | default + others | ✅ |
windows | ✅ | default only | ✅ |
linux/wsl | ✅ | default only (respects $BROWSER env var, so can be used with other browsers) | ✅ |
android | ✅ | default only | ✅ |
ios/tvOS/visionOS | ✅ | default only | ✅ |
wasm | ✅ | default only | ✅ |
unix (*bsd, aix etc.) | ✅ | default only (respects $BROWSER env var, so can be used with other browsers) | Manual |
webbrowser
defines consistent behaviour on all platforms as follows:
webbrowser::open_browser_with_options
.webbrowser
optionally allows the following features to be configured:
hardened
- this disables handling of non-http(s) urls (e.g. file:///
) as a hard security precautiondisable-wsl
- this disables WSL file
implementation (http
still works)wasm-console
- this enables logging to wasm console (valid only on wasm platform)PRs invited for
Important note (while testing):
cargo test
will actually open the browser locallyWhen contributing, please note that your work will be dual licensed as MIT + Apache-2.0 (see below).
SPDX-License-Identifier: Apache-2.0 OR MIT
Licensed under either of
at your option.
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.