Skip to content

DexterFromLab/shared-browsing-claude

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”— Shared Browsing with Claude Code

Browse the internet together with Claude! Share webpage content instantly and ask questions directly in your browser with automatic Claude Code integration.

🎯 Dual Mode Operation

⌨️ Two Keyboard Shortcuts Available

πŸ“ Ctrl+Shift+C - Classic Mode (Context Sharing)

  • Instantly shares webpage content to Claude Code context
  • Continue conversation in Claude Code terminal
  • Perfect for ongoing discussions and analysis
  • Works exactly like the original version

πŸš€ Ctrl+Shift+D - Interactive Mode (Direct Questions)

  • Opens beautiful popup dialog
  • Ask questions directly about the webpage
  • Claude responds in popup - no window switching!
  • Automatic Claude Code integration via subprocess
  • Session-specific context files for each conversation

πŸ’‘ Best of Both Worlds

Use Ctrl+Shift+C when you want to build context for ongoing conversation, and Ctrl+Shift+D when you have a quick question about the current page!

πŸš€ Quick Start

1. Install API Server

cd shared_browsing/
pip3 install flask flask-cors requests beautifulsoup4
./start.sh

2. Install Firefox Extension

  1. Open Firefox
  2. Go to about:debugging
  3. Click "This Firefox"
  4. Click "Load Temporary Add-on..."
  5. Select firefox_extension/manifest.json

3. Start Browsing Together!

  • Visit any webpage
  • Press Ctrl+Shift+C for classic context sharing
  • Press Ctrl+Shift+D for interactive questions
  • Both modes work simultaneously!

⚑ How to Use

πŸ“ Classic Mode (Ctrl+Shift+C)

  1. Ctrl+Shift+C on any webpage
  2. Content shared to Claude Code context
  3. Switch to Claude Code terminal
  4. Ask questions about the shared content
  5. Perfect for ongoing conversations and context building

πŸš€ Interactive Mode (Ctrl+Shift+D)

  1. Ctrl+Shift+D on any webpage
  2. Beautiful popup appears with page title and URL
  3. Type your question about the page content
  4. Click "Ask Claude" (or Ctrl+Enter)
  5. Claude analyzes the full page content automatically
  6. Response appears in the popup instantly!

Examples:

  • "What is this article about?"
  • "Summarize the main points"
  • "Is there anything controversial here?"
  • "What are the key takeaways?"

Alternative Methods (Both Versions)

  • Extension Icon: Click toolbar icon
  • Right-click Menu: "πŸ“€ Share with Claude"

🎯 What Gets Shared

  • Page title and URL
  • Full page content (no length limits in develop!)
  • Timestamp for context
  • No sensitive data (passwords filtered out)

βœ… Security Features

  • Automatic password field filtering
  • Script and style removal
  • Ad and navigation filtering
  • Content sanitization for safe processing
  • Session-specific context files (develop branch)

πŸ”§ Requirements

  • Firefox 60+
  • Python 3.7+
  • API server running on 127.0.0.1:8080

πŸ“ Project Structure

shared_browsing/
β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ server.py          # Main API server
β”‚   β”œβ”€β”€ requirements.txt   # Python dependencies
β”‚   └── context_history.json  # Saved context
β”œβ”€β”€ firefox_extension/
β”‚   β”œβ”€β”€ manifest.json      # Extension config
β”‚   β”œβ”€β”€ background.js      # Background script
β”‚   β”œβ”€β”€ content.js         # Content extraction
β”‚   β”œβ”€β”€ popup.html         # Extension popup
β”‚   └── popup.js           # Popup logic
└── README.md             # This file

🚨 Troubleshooting

Extension shows "Failed to share"

  • Check if API server is running: curl 127.0.0.1:8080/api/status
  • Restart the server: ./start.sh

"API offline" in popup

  • Make sure server is running on port 8080
  • Check firewall settings

Content not appearing in Claude

  • Verify the server GUI shows received content
  • Check browser console for errors (F12)

πŸ”₯ Pro Tips

  1. Batch browsing: Share multiple pages quickly with Ctrl+Shift+C
  2. Context persistence: All shared content is saved automatically
  3. Logged-in content: Works with authenticated/personalized pages
  4. Clean extraction: Main content only, no ads or navigation

πŸ’‘ Example Workflow

  1. 🌐 Browse to interesting article/discussion
  2. ⌨️ Press Ctrl+Shift+C
  3. πŸ€– Ask Claude about the content
  4. πŸ”„ Continue browsing and sharing
  5. πŸ’¬ Maintain context across multiple pages

No more copy-paste! Instant context sharing! πŸŽ‰

βœ… Status: TESTED & WORKING

This system has been successfully tested and verified to work with:

  • βœ… Firefox Extension: Captures content via Ctrl+Shift+C
  • βœ… API Server: Runs on 127.0.0.1:8080 with CORS enabled
  • βœ… Content Filtering: Automatically removes passwords and sensitive data
  • βœ… Context Persistence: Maintains conversation history across pages
  • βœ… Claude Integration: Real-time content sharing with Claude Code

Last tested: October 2025 with Firefox and Python 3.9

πŸ› οΈ Advanced Usage

API Endpoints

  • GET /api/status - Check server status
  • POST /api/extract - Extract webpage content
  • POST /api/add_message - Add user message to context
  • GET /api/get_context - Get full context for Claude
  • POST /api/clear_context - Clear context history
  • POST /api/ask_claude - Ask Claude directly (develop branch only)

Manual Testing

# Test server status
curl http://127.0.0.1:8080/api/status

# Extract webpage
curl -X POST http://127.0.0.1:8080/api/extract \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "method": "requests"}'

# Test interactive Claude (develop branch only)
curl -X POST http://127.0.0.1:8080/api/ask_claude \
  -H "Content-Type: application/json" \
  -d '{"pageData": {"url": "https://example.com", "content": "Sample content"}, "prompt": "What is this about?"}'

πŸŽ‰ New in Develop Branch

πŸš€ Interactive Claude Integration

  • No more context switching! Ask questions directly in browser
  • Beautiful popup interface with real-time responses
  • Automatic Claude Code execution via subprocess
  • Session-specific context files for better isolation
  • Enhanced prompt engineering ensures Claude reads full page content

πŸ”§ Technical Improvements

  • Removed all content length limits for full page extraction
  • Session-based context files (session_context_[timestamp].json)
  • Enhanced error handling and timeout management
  • Auto-cleanup of temporary files after 5 minutes
  • Improved README and documentation for AI agents

πŸ’‘ Inspired by Community

Thanks to Knight WIRTUOZ from Hejto.pl for suggesting the interactive popup feature that eliminates window switching!

πŸ†š Main vs Develop Comparison

Feature Main Branch Develop Branch
Content Sharing βœ… Ctrl+Shift+C βœ… Ctrl+Shift+C
Claude Integration Manual (context) πŸš€ Automatic (popup)
User Experience Switch to terminal Stay in browser
Response Time Depends on manual input ⚑ Instant
Content Limits Basic filtering πŸ”₯ No limits
Session Management Single context file πŸ“ Per-session files

Recommendation: Use develop branch for the best experience!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors