browser-info
๐ Used by
- 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.
โจ Features
- โก 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
๐ Quick Start
Basic Usage
use get_active_browser_info;
Async API (with DevTools support)
use ;
async
Method Selection
use ;
// Fast & Compatible (PowerShell - Recommended)
let info = get_browser_info_safe?;
// Just get the URL (lightweight)
let url = get_active_browser_url?;
// Explicit Method Selection
let info = get_browser_info_with_method.await?;
// DevTools method (Windows only, requires debug mode)
let info = get_browser_info_detailed.await?;
๐ฆ Installation
Add to your Cargo.toml
:
[]
= "0.2"
# Optional: for async API and DevTools support
= { = "1.0", = ["full"] }
= { = "0.11", = ["json"] }
Features
default = ["devtools"]
: Includes DevTools support (Windows only)devtools
: Chrome DevTools Protocol support (requiresreqwest
andtokio
)
๐๏ธ Extraction Methods
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 Support
Platform | Status | Methods Available |
---|---|---|
Windows | โ Full | PowerShell, DevTools, Auto |
macOS | ๐ง Partial | AppleScript, Auto |
Linux | โณ Planned | Coming soon |
Chrome DevTools Setup (Optional)
For DevTools method on Windows, start Chrome with debug mode:
๐ Performance
Based on our benchmarks:
- PowerShell: ~0.4ms (sub-millisecond)
- AppleScript: ~50ms (native macOS)
- DevTools: ~300ms (network overhead)
- Auto: Uses fastest available method per platform
๐ง Development
Building
# Build with all features
# Build without DevTools (faster compilation)
# Platform-specific builds
Testing
# Run all tests
# Run platform-specific tests
๐ Examples
Check out /examples
for more usage patterns:
๐งช Benchmarking
Run performance tests:
View detailed HTML reports in target/criterion/
.
๐ก๏ธ Security
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
๐ Troubleshooting
Common Issues
Windows: "PowerShell execution policy"
DevTools: "Connection refused"
- Ensure Chrome is running with
--remote-debugging-port=9222
- Check if port 9222 is not blocked by firewall
Debug Mode
Enable debug logging:
;
let info = get_active_browser_info?;
init
๐ค Contributing
Contributions welcome! Please see our contributing guidelines.
Development Setup
- Clone the repository
- Install Rust (1.87+ required)
- Run tests:
cargo test --all-features
- Submit a pull request
Roadmap
- Linux support (X11 and Wayland)
- Firefox DevTools Protocol support
- Browser extension API
- WebDriver integration
๐ License
Licensed under MIT License. See LICENSE for details.