A privacy-focused browser extension that automatically removes tracking parameters and follows redirect chains to give you clean, direct URLs.
- Features
- Installation
- How It Works
- Project Structure
- Usage
- Testing
- Known Limitations
- Roadmap
- Contributing
- License
-
🧹 Automatic Tracking Parameter Removal: Strips 20+ common tracking parameters including:
- Google Analytics (
utm_*,gclid) - Facebook (
fbclid) - Microsoft/Bing (
msclkid) - Email marketing (
mc_cid,_hsenc) - And many more
- Google Analytics (
-
🔗 Redirect Chain Following: Automatically traces URL shorteners and redirect chains to find the final destination
- Follows up to 10 redirects
- 5-second timeout for safety
- Graceful fallback on CORS errors
-
📊 Usage Statistics: Track your privacy improvements
- Total links processed
- Redirects followed
- Tracking parameters removed
- Average processing time
-
🎯 Smart Link Interception: Works with all click types
- Normal clicks
- Ctrl/Cmd + Click (new tab)
- Middle mouse button
- Context menu "Open in new tab"
-
⚡ Background Processing: Non-blocking architecture that processes URLs without freezing your browser
-
Clone or download this repository
git clone <repository-url> cd link-cleaner-extension
-
Open your browser's extension page
- Chrome:
chrome://extensions/ - Brave:
brave://extensions/ - Edge:
edge://extensions/
- Chrome:
-
Enable Developer Mode
- Toggle the switch in the top-right corner
-
Load the extension
- Click "Load unpacked"
- Select the
link-cleaner-extensionfolder - The extension should now appear in your extensions list
-
Verify installation
- Look for the extension icon in your toolbar
- Click it to see the statistics popup
User clicks link
↓
Content Script (content.js) intercepts click
↓
Sends URL to Background Service Worker (background.js)
↓
├─→ [Step 1] Trace Redirects
│ • Follow HTTP 3xx redirects
│ • Handle URL shorteners
│ • Timeout after 5 seconds
│ • Fallback on CORS errors
↓
├─→ [Step 2] Clean Tracking Parameters
│ • Parse URL query string
│ • Remove known tracking params
│ • Preserve functional parameters
↓
Final clean URL returned to Content Script
↓
Browser navigates to clean URL
- manifest.json: Extension configuration and permissions
- background.js: Main processing logic (service worker)
- content.js: Link click interception on web pages
- popup.html/js: Statistics dashboard UI
- icons/: Extension icons (16x16, 48x48, 128x128)
link-cleaner-extension/
├── manifest.json # Extension configuration
├── background.js # Background service worker (main logic)
├── content.js # Content script (link interception)
├── popup.html # Extension popup UI
├── popup.js # Popup logic and statistics
├── icons/ # Extension icons
│ ├── icon16.png
│ ├── icon48.png
│ └── icon128.png
├── test-links.html # Test page for development
├── README.md # This file
└── SETUP.md # Detailed setup instructions
Once installed, the extension works automatically:
- Browse normally - Click any link as usual
- Watch it work - Brief processing delay (1-5 seconds)
- Arrive at clean URL - Tracking parameters removed, redirects followed
Click the extension icon to see:
- Total links processed
- Redirects followed
- Trackers removed
- Average processing time
Toggle the extension on/off from the popup interface.
Click "Reset Statistics" in the popup to clear all tracking data.
- Open
test-links.htmlin your browser - Click through the test scenarios
- Verify URLs in address bar are cleaned
- Check console for processing logs (F12)
Test with real-world links:
- Google search results (lots of
utm_*parameters) - Facebook shared links (
fbclid) - Amazon product links (
ref,tag) - URL shorteners (bit.ly, tinyurl.com)
View Content Script Logs:
- Press F12 on any webpage
- Check Console tab
- Look for "Smart Link Cleaner: Content script loaded"
View Background Script Logs:
- Go to
chrome://extensions/(orbrave://extensions/) - Find Smart Link Cleaner
- Click "service worker" link
- Check console output
-
CORS Restrictions: Many sites block cross-origin HEAD requests, preventing redirect tracing
- Workaround: Extension falls back to original URL
- Future: Will add CORS proxy option
-
JavaScript Redirects: Only detects HTTP 3xx redirects, not JS-based redirects
- Example:
window.location = ...not detected - Future: Will add JS redirect detection
- Example:
-
Processing Latency: Adds 1-5 seconds to navigation time
- Cause: Network requests to trace redirects
- Future: Will add caching and performance optimizations
-
Limited Tracking Parameter List: Currently removes ~20 common parameters
- Future: Will expand to 100+ parameters
-
No VirusTotal Integration: Security checking not yet implemented
- Status: Planned for next release
- Visual loading indicators during processing
- Toast notifications for actions taken
- Expanded tracking parameter list (100+)
- Whitelist/trusted domains feature
- Better CORS error handling
- Settings page
- Context menu integration
- Redirect result caching
- VirusTotal integration for security scanning
- Better statistics dashboard with graphs
- Export data to CSV/JSON
- JavaScript redirect detection
- Performance optimizations
- Keyboard shortcuts
Machine Learning Features:
- ML-powered phishing detection model
- Smart tracking parameter classification
- Behavioral anomaly detection for suspicious redirects
- Federated learning for collaborative threat intelligence
- NLP-based link context analysis
This project is designed to bridge browser extension development with ML/data science:
The extension logs structured data about:
- URL patterns and tracking parameters
- Redirect chains and their characteristics
- User behavior (which links get clicked, which get whitelisted)
- Performance metrics
- Phishing Detection: Train classifier on URL features
- Smart Parameter Filtering: Learn which params are functional vs tracking
- Anomaly Detection: Flag unusual redirect patterns
- Recommendation System: Suggest whitelist additions
Statistics can be exported for analysis in Python/R:
// From browser console
chrome.storage.local.get(['linkStats'], (result) => {
console.log(JSON.stringify(result));
});This is currently a personal project, but contributions are welcome!
- Expanding the tracking parameter list
- Testing on different websites and reporting issues
- Performance optimizations
- UI/UX improvements
- Documentation improvements
- JavaScript (ES6+): Core language
- Chrome Extension Manifest V3: Extension framework
- Web APIs: Fetch, URLSearchParams, Chrome Extension APIs
- No external dependencies: Vanilla JS only (for now)
- Manifest V3 over V2: Future-proofing (V2 being deprecated)
- Inline code in background.js: Avoids bundler complexity for MVP
- HEAD requests for redirects: Efficient, doesn't download full page
- 5-second timeout: Balance between thoroughness and UX
- Graceful degradation: Always falls back to original URL on errors
- Uses
HEADrequests (no body download) - Implements timeouts to prevent hanging
- Runs in background worker (non-blocking)
- Statistics stored locally (no server calls)
This project is licensed under the MIT License - see the LICENSE file for details.
Built as a learning project to bridge browser extension development with machine learning and data science.
Extension doesn't load:
- Check manifest.json syntax (use jsonlint.com)
- Verify all files are in the folder
- Check for errors in
chrome://extensions/
Links aren't processed:
- Verify extension is enabled (check popup)
- Check console for JavaScript errors
- Try reloading the extension
Slow navigation:
- Expected behavior (tracing redirects takes time)
- Will improve with caching in future versions
CORS errors:
- Normal for many sites
- Extension falls back to original URL
- Not a bug, browser security feature
- Check the console logs (both page and service worker)
- Review
SETUP.mdfor detailed troubleshooting - Open an issue on GitHub (if applicable)
Last Updated: 2025 Status: In Active Development 🚧