Browser Tab Debugger
Execute JavaScript files on Chrome tabs via remote debugging.
Setup
- Install dependencies:
npm install
- Start Chrome with remote debugging enabled:
chrome.exe --remote-debugging-port=9222
Or on Windows, run from PowerShell:
& "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
Usage
Option 1: VS Code Debug Configuration
- Open the JavaScript file you want to execute (e.g.,
example.js) - Press F5 or go to Run and Debug
- Select "Execute Script on Current Tab"
- The script will run on the currently active Chrome tab
Option 2: Command Line
node run-script.js example.js
How it works
The script connects to Chrome's DevTools Protocol on port 9222, finds the first active page tab, and executes your JavaScript code using Runtime.evaluate.
Description
Languages
JavaScript
100%