- Atode-GUI(mine) - Read-later article management tool with quick save functionality
If you use browser-info in your project, let me know and I'll add you to the list!
🚀 Cross-platform library for retrieving active browser URL and detailed information.
Fast, reliable, and easy-to-use browser information extraction with multiple strategies.
- ⚡ Ultra Fast: PowerShell-based extraction (sub-millisecond performance)
- 🔧 DevTools Support: Chrome DevTools Protocol for advanced scenarios (Windows only)
- 🌐 Multi-Browser: Chrome, Firefox, Edge, Safari, Brave, Opera, Vivaldi
- 🎛️ Multiple Strategies: Choose between speed, compatibility, or detailed info
- 🔄 Auto Fallback: Intelligent method selection with graceful fallbacks
- 🖥️ Cross-Platform: Windows (full support), macOS (partial), Linux (planned)
- 🔒 Security-First: No vulnerable dependencies, regular security audits
use browser_info::get_active_browser_info;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Check if a browser is currently active
if !browser_info::is_browser_active() {
println!("No browser is currently active");
return Ok(());
}
// Get comprehensive browser information
let info = get_active_browser_info()?;
println!("📖 Title: {}", info.title);
println!("🔗 URL: {}", info.url);
println!("🌐 Browser: {:?}", info.browser_type);
println!("📍 Position: ({}, {})", info.window_position.x, info.window_position.y);
println!("🔒 Incognito: {}", info.is_incognito);
Ok(())
}use browser_info::{get_browser_info, ExtractionMethod};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Auto-detection with fallback (PowerShell → DevTools)
let info = get_browser_info().await?;
println!("URL: {}", info.url);
Ok(())
}use browser_info::{get_browser_info_safe, ExtractionMethod, get_browser_info_with_method};
// Fast & Compatible (PowerShell - Recommended)
let info = get_browser_info_safe()?;
// Just get the URL (lightweight)
let url = browser_info::get_active_browser_url()?;
// Explicit Method Selection
let info = get_browser_info_with_method(ExtractionMethod::PowerShell).await?;
// DevTools method (Windows only, requires debug mode)
#[cfg(all(feature = "devtools", target_os = "windows"))]
let info = browser_info::get_browser_info_detailed().await?;Add to your Cargo.toml:
[dependencies]
browser-info = "0.2"
# Optional: for async API and DevTools support
tokio = { version = "1.0", features = ["full"] }
reqwest = { version = "0.11", features = ["json"] }default = ["devtools"]: Includes DevTools support (Windows only)devtools: Chrome DevTools Protocol support (requiresreqwestandtokio)
| Method | Speed | Setup Required | Platform | Best For |
|---|---|---|---|---|
| Auto | ⚡ Fast | None | Windows, macOS | General use (recommended) |
| PowerShell | ⚡ Ultra Fast | None | Windows | Production, reliability |
| DevTools | 🔧 Moderate | Chrome debug mode | Windows only | Advanced info, no UI interference |
| AppleScript | 🍎 Fast | None | macOS only | Native macOS support |
| Platform | Status | Methods Available |
|---|---|---|
| Windows | ✅ Full | PowerShell, DevTools, Auto |
| macOS | 🚧 Partial | AppleScript, Auto |
| Linux | ⏳ Planned | Coming soon |
For DevTools method on Windows, start Chrome with debug mode:
chrome.exe --remote-debugging-port=9222 --user-data-dir=tempBased on our benchmarks:
- PowerShell: ~0.4ms (sub-millisecond)
- AppleScript: ~50ms (native macOS)
- DevTools: ~300ms (network overhead)
- Auto: Uses fastest available method per platform
# Build with all features
cargo build --all-features
# Build without DevTools (faster compilation)
cargo build --no-default-features
# Platform-specific builds
cargo build --target x86_64-pc-windows-msvc
cargo build --target x86_64-apple-darwin# Run all tests
cargo test --all-features
# Run platform-specific tests
cargo test --features devtools # Windows onlyCheck out /examples for more usage patterns:
cargo run --example basic_usageRun performance tests:
cargo benchView detailed HTML reports in target/criterion/.
This library prioritizes security:
- ✅ No vulnerable dependencies - Regular security audits with
cargo audit - ✅ Safe Rust - No unsafe code blocks
- ✅ Input validation - All external data is validated
- ✅ CI/CD security - Automated security scanning in GitHub Actions
Windows: "PowerShell execution policy"
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserDevTools: "Connection refused"
- Ensure Chrome is running with
--remote-debugging-port=9222 - Check if port 9222 is not blocked by firewall
Enable debug logging:
env_logger::init();
let info = get_active_browser_info()?;Contributions welcome! Please see our contributing guidelines.
- Clone the repository
- Install Rust (1.87+ required)
- Run tests:
cargo test --all-features - Submit a pull request
- Linux support (X11 and Wayland)
- Firefox DevTools Protocol support
- Browser extension API
- WebDriver integration
Licensed under MIT License. See LICENSE for details.