π΅ YTM Keep-Alive
February 22, 2026 Β· View on GitHub
π΅ YTM Keep-Alive
A lightweight, pure DOM bookmarklet to prevent YouTube and YouTube Music from pausing with the "Video paused. Continue watching?" prompt.
β¨ Features
- No Extensions Required: Keeps your browser fast and clean.
- 100% Safe (TrustedHTML Bypass): Built entirely with pure DOM elements (
document.createElement). It does not useinnerHTML, completely bypassing YouTube's strict Content Security Policy (CSP). - Draggable UI: Features a sleek, dark-themed floating timer that you can drag anywhere on the screen.
- Smart Detection: Clicks the "Yes" confirmation button automatically within seconds of it appearing.
π Easy Installation
You don't need to copy or paste any code.
- Go to the Installation Page
- Drag and drop the red "Drag to Bookmarks" button to your browser's bookmarks bar.
- Open YouTube Music, click the bookmark, and enjoy uninterrupted music!
π οΈ How it Works
Once activated, it creates a sleek floating widget. It now scans the DOM every single second for the confirmation prompt, ensuring lightning-fast detection. To prevent the browser from suspending the background tab, it bypasses the Page Visibility API and performs a 1-pixel micro-scroll every minute. If the prompt is found, it automatically clicks it, increments the live "Prevented" counter, and displays a "Pause Prevented!" notification on the widget.
π Browser Support
This bookmarklet uses standard web APIs and pure DOM manipulation, making it fully compatible with all modern desktop browsers:
- β Google Chrome (Windows, macOS, Linux)
- β Mozilla Firefox
- β Microsoft Edge
- β Brave Browser
- β Opera / Opera GX
- β Safari (macOS)
Note: Mobile browsers generally do not support a traditional bookmarks bar for bookmarklets, so this tool is designed for desktop use.
π¨βπ» For Developers
The code inside the installation button on the index.html page is minified to work effectively as a single-line bookmarklet.
If you want to read, review, or contribute to the source code, please check the ytm-keep-alive.js file. It contains the fully formatted, commented, and readable version of the script.
Note: All pull requests modifying the core logic should be applied to ytm-keep-alive.js first.