| Crates.io | browser-info |
| lib.rs | browser-info |
| version | 1.0.0 |
| created_at | 2025-07-14 15:12:30.116629+00 |
| updated_at | 2025-08-31 01:44:32.097867+00 |
| description | Cross-platform(planned) library retrieving active browser URL and detailed information |
| homepage | https://github.com/frkavka/browser-info |
| repository | https://github.com/frkavka/browser-info |
| max_upload_size | |
| id | 1751882 |
| size | 130,406 |
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.
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 (requires reqwest and tokio)| 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=temp
Based on our benchmarks:
# 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 only
Check out /examples for more usage patterns:
cargo run --example basic_usage
Run performance tests:
cargo bench
View detailed HTML reports in target/criterion/.
This library prioritizes security:
cargo auditWindows: "PowerShell execution policy"
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
DevTools: "Connection refused"
--remote-debugging-port=9222Enable debug logging:
env_logger::init();
let info = get_active_browser_info()?;
Contributions welcome! Please see our contributing guidelines.
cargo test --all-featuresLicensed under MIT License. See LICENSE for details.