Manifest v3 background scripts/service worker on Firefox

Just faced the same problem: Chrome is not happy with background.scripts and insists on using background.service_worker Firefox doesn’t support background.service_worker and wants background.scripts Manifest v3 is developed by Google, so looks like Firefox team haven’t fully implemented it yet. Firefox 109 is the first version to “support” manifest v3 (released on January 17). I was … Read more

Testing browser extensions

I practise two different ways of testing my browser extensions: Unit tests Integration test Introduction I will use the cross-browser YouTube Lyrics by Rob W extension as an example throughout this answer. The core of this extension is written in JavaScript and organized with AMD modules. A build script generates the extension files for each … Read more

Multiple JS files in Chrome Extension – how to load them?

UPDATE : This solution works only if you are using manifest V2. You can also do this the extremely easy way that is described here: https://developer.chrome.com/extensions/background_pages#manifest { “name”: “My extension”, … “background”: { “scripts”: [ “lib/fileone.js”, “lib/filetwo.js”, “background.js” ] }, … } You won’t be doing lazy loading, but it does allow you to break … Read more

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

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. ManifestV3 manifest.json: “background”: {“service_worker”: “background.js”}, “permissions”: [“scripting”], … 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

How to get started with developing Internet Explorer extensions?

[UPDATE] I’m updating this answer to work with Internet Explorer 11, in Windows 10 x64 with Visual Studio 2017 Community. The previous version of this answer (for Internet Explorer 8, in Windows 7 x64 and Visual Studio 2010) is at the bottom of this answer. Creating a Working Internet Explorer 11 Add-on I am using … Read more