background.js file is an essential component in the extension’s architecture, managing communication between the content script and the DevTools panel. It sets up listeners for various events, injects the content script into active tabs, and forwards messages from the content script to the DevTools panel.
Overview
The background script sets up listeners for the following events:- Connection from the DevTools panel
- Tab activation
- Messages from the content script
- Context menu item clicks

