How do I import scripts into a service worker using Chrome extension manifest version 3?

First off, important warnings: Warning: Chrome 92 or older doesn’t show errors occurred in the service worker – it was a bug, fixed in newer Chrome, which now shows the errors in chrome://extensions page. These old versions of Chrome can’t register the background script if an unhandled exception occurs during its compilation (a syntax error … Read more

How to override content security policy while including script in browser JS console?

You can turn off the CSP for your entire browser in Firefox by disabling security.csp.enable in the about:config menu. If you do this, you should use an entirely separate browser for testing. For example, install Firefox Developer Edition alongside your normal browser and use that for testing (and not normal Web use). As an alternative, … Read more

chrome extension mv3 – Modularize service worker js file

First off, important warnings: Warning: Chrome 92 or older doesn’t show errors occurred in the service worker – it was a bug, fixed in newer Chrome, which now shows the errors in chrome://extensions page. These old versions of Chrome can’t register the background script if an unhandled exception occurs during its compilation (a syntax error … Read more

Chrome extension content script re-injection after upgrade or install

There’s a way to allow a content script heavy extension to continue functioning after an upgrade, and to make it work immediately upon installation. Install/upgrade The install method is to simply iterate through all tabs in all windows, and inject some scripts programmatically into tabs with matching URLs. Obviously, you have to do it in … Read more