A professional Chrome extension that prevents Google Colab notebooks from disconnecting due to inactivity.
- ✅ Automatic Activity Simulation - Simulates user activity every 60 seconds
- ✅ Auto-Reconnect - Automatically clicks the connect button if disconnected
- ✅ Auto-Start Option - Optionally start keepalive automatically when you open Colab
- ✅ Clean UI - Modern, intuitive popup interface
- ✅ Lightweight - Minimal resource usage
- ✅ Manifest V3 - Uses the latest Chrome extension architecture
- Clone or download this repository
- Open Chrome and navigate to
chrome://extensions/ - Enable Developer mode (toggle in top-right corner)
- Click Load unpacked
- Select the
colab_keepalivefolder - The extension icon should appear in your toolbar
The extension needs three icon sizes. You can:
Option 1: Use a placeholder
# Create simple colored squares as placeholders
# You'll need image editing software or online toolsOption 2: Generate programmatically
# Run this Python script to generate simple icons
python generate_icons.py- Open Google Colab - Navigate to https://colab.research.google.com/
- Open a notebook - Create or open any notebook
- Click the extension icon - The popup will show the current status
- Start Keepalive - Click "Start Keepalive" button
- Verify - Status indicator turns green when active
- Check "Auto-start on page load" in the popup
- Keepalive will automatically activate whenever you open a Colab notebook
- Preference is saved and persists across browser sessions
The extension operates in three phases:
-
Activity Simulation - Every 60 seconds, it:
- Simulates mouse movement on the page
- Triggers mouseover events on notebook elements
- Keeps the session active
-
Connection Monitoring - Continuously checks for:
- Disconnection status
- Connect button visibility
- Automatic reconnection when needed
-
State Management - Tracks:
- Active/inactive status per tab
- User preferences (auto-start)
- Extension lifecycle
colab_keepalive/
├── manifest.json # Extension configuration
├── background.js # Service worker (background tasks)
├── content.js # Content script (runs on Colab pages)
├── popup.html # Popup UI structure
├── popup.js # Popup UI logic
├── icon16.png # 16x16 icon
├── icon48.png # 48x48 icon
├── icon128.png # 128x128 icon
└── README.md # This file
- Manifest Version: 3 (latest Chrome standard)
- Permissions:
activeTab- Access to current tabscripting- Inject content scriptsstorage- Save preferences
- Host Permissions:
https://colab.research.google.com/* - Architecture:
- Service Worker for background tasks
- Content Script for page interaction
- Popup for user interface
-
Setup
# No build process needed - pure vanilla JS # Just ensure all files are present
-
Testing
- Load extension in developer mode
- Open Chrome DevTools
- Check Console for debug messages
- Test on actual Colab notebooks
-
Debugging
- Background Script:
chrome://extensions/→ Click "service worker" - Content Script: Open DevTools on Colab page
- Popup: Right-click extension icon → Inspect popup
- Background Script:
- ✅ Comprehensive error handling
- ✅ JSDoc comments throughout
- ✅ Proper async/await usage
- ✅ Clean separation of concerns
- ✅ No external dependencies
- Refresh the Colab page after installing/enabling
- Check permissions - Ensure all required permissions are granted
- Verify you're on Colab - Extension only works on
colab.research.google.com - Check console - Look for error messages in DevTools
- Make sure you're on a Google Colab page
- URL should include
colab.research.google.com
- Ensure
icon16.png,icon48.png, andicon128.pngexist in the extension folder - Use the
generate_icons.pyscript to create them - Reload the extension after adding icons
- ✅ No data collection - Extension doesn't collect or transmit any data
- ✅ Local storage only - Preferences stored locally on your machine
- ✅ Minimal permissions - Only requests necessary permissions
- ✅ Open source - All code is visible and auditable
- Configurable interval timing
- Activity log viewer
- Notification on disconnect/reconnect
- Multiple notebook support
- Statistics tracking (uptime, reconnections)
MIT License - Feel free to use, modify, and distribute
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues or questions:
- Open an issue on GitHub
- Check existing issues for solutions
- Review the troubleshooting section
Made with ❤️ for Colab users who want uninterrupted runtime