If you are on this page, you are probably extension developer that is in trouble. In this post I will try to help you introduce workaround that works.
Context
As you know a lot of APIs was removed or deprecated by introducing Manifest V3. It was advertised as change for good direction. As increased user privacy, better performance etc. Unfortunately by looking at how changes works in the runtime, what workarounds were created for a couple of problems and what changes were done since the announcing MV3, im not quite sure that this was change for good.
Declarative net request api as a cure
We could reimplement our code in order to use declarativeNetRequest
, but this API won't allow us to do everything we need - in the code we could implement action that is needed in a way that we want to.
Workaround
Are you developing enterprise and self-hosted browser extension? You are saved!
According to the Google Chrome documentation (should work on Edge too) you are able to still use blocking version of webRequest
API.
You just need to add webRequestBlocking
into the manifest permissions.
Are there any drawbacks of that approach?
Unfortunately, they are...
Because of some bug in Chromium project we could not run that code locally (when using unpacked version of your extension). Extension must be deployed to your enterprise domain via policy.
So testing your code could be quite tricky. I advise you to do it on internal version that is hidden from production environment and your customers. Apart from that everything works as before. Hope this API would be still available after sunsetting MV2 extensions.
Other good news, Firefox claimed that they would be still maintaining this API.
Top comments (0)