MCPcopy Index your code
hub / github.com/amodm/webbrowser-rs

github.com/amodm/webbrowser-rs @v1.2.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.1 ↗ · + Follow
120 symbols 234 edges 19 files 45 documented · 38% updated 39d agov1.2.1 · 2026-04-16★ 3233 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

webbrowser

Current Crates.io Version Crates.io Downloads License

Linux Build Windows Build MacOS Build iOS Build Android Build WASM Build

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

Documentation

Examples

use webbrowser;

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

Platform Support

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

Consistent Behaviour

webbrowser defines consistent behaviour on all platforms as follows: * Browser guarantee - This library guarantees that the browser is opened, even for local files - the only crate to make such guarantees at the time of this writing. Alternative libraries rely on existing system commands, which may lead to an editor being opened (instead of the browser) for local html files, leading to an inconsistent behaviour for users. * 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.

Crate Features

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 precaution * disable-wsl - this disables WSL file implementation (http still works) * wasm-console - this enables logging to wasm console (valid only on wasm platform)

Looking to contribute?

PRs invited for

  • Bugs
  • Supporting non-default browser invocation on any platform

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

SPDX-License-Identifier: Apache-2.0 OR MIT

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.

Core symbols most depended-on inside this repo

Shape

Function 90
Method 20
Class 7
Enum 3

Languages

Rust100%

Modules by API surface

src/lib.rs27 symbols
src/unix.rs25 symbols
tests/test_macos.rs10 symbols
tests/test_windows.rs8 symbols
src/macos.rs8 symbols
tests/test_unix.rs7 symbols
tests/common.rs7 symbols
src/android.rs6 symbols
tests/test_ios.rs4 symbols
src/ios.rs4 symbols
tests/test_android.rs3 symbols
src/windows.rs3 symbols

For agents

$ claude mcp add webbrowser-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page