AdGuard publishes the world's first ad blocker built on Manifest V3

Manifest V3, Chrome's new extension API, is no longer an illusory threat. It's now the new reality in which dozens of ad-blocking extensions, including the AdGuard Browser extension, will (or won't) work.

The wave of Manifest V3 has been building gradually but inexorably. In 2018, when Google first released a document describing the new API, the developer community erupted in criticism. We didn't stand aside either and published several articles describing the possible negative consequences of Manifest V3 implementation and even expressed hope that "things won't turn out so badly".

Despite the public outcry, Manifest V3 became available in late 2020 along with Chrome 88 Beta. Since January 2022, it became impossible to add new extensions based on Manifest V2 to the Chrome Web Store. The last phase of the launch will come very soon: starting in January 2023, all extensions on Manifest V2 will stop working, even those that were added to Chrome Web Store earlier.

If you're using AdGuard for Windows, Mac or Android, you should not worry about MV3 at all. These products are not limited by any browser.

Fortunately, we're ready for it.

Experimental AdGuard MV3 Browser extension

Experimental AdGuard MV3 Browser extension

In mid-2021, we started working on the prototype of a new extension that would be able to block ads even within the strict limits of Manifest V3. The task was not an easy one: the new API was still raw, some aspects were being finalized and did not work as intended. But we coped with it, of course, and proved that ad blockers will survive even after the apocalypse that is Manifest V3.

While developing the prototype, we faced a lot of serious problems caused by the features of the new API: some of them we managed to overcome, and some we had to reconcile with. We will talk about each of them in detail.

Meanwhile, if you want to try it, you can install it from Chrome WebStore.

Here's a short video that shows how it works

Rule limits

If you don't know what filtering rules are and how ad blocking works in general, or if you'd like to refresh your knowledge, visit our Knowledge base for a brief explanation.

All the rules included in the extension filters were divided by Manifest V3 into static (built-in) and dynamic rules and their number was drastically limited.

For static rules, Chrome set a minimum guaranteed limit of 30,000 rules per extension and a total limit of 330,000 rules for all extensions installed by a single user (this also takes into account the limit of 1,000 regexp rules per extension). The trick is that one extension may get all of the allowed amount of rules, or there may be more than one, and then perhaps some of the extensions will fall short of the limit.

Notification about changes in the list of active filters

If this occurs with our extension (and this can happen at any time, e.g. after an update, service worker restart, change of filter set in our or third-party blockers), it will show a message saying that the browser has modified the list of active filters and left only AdGuard basic ad filter enabled. In the worst case, even the basic filter might not be enabled, because it contains more than 30,000 rules. Then the user would be left without AdGuard protection.

All of these cases are envisaged by us and are displayed on a separate screen with a description of what the browser has disabled and what it has left enabled.

The list of enabled and disabled filters

For dynamic rules, within which users can add their own rules or filters, there is a tiny limit of 5,000, including the limit of 1,000 regexp rules. If this limit is exceeded, AdGuard MV3 will only be able to apply the first 5,000 rules and the rest will remain inactive.

Notifications about exceeding the limit will look this way:

Notification about reaching the limit

Manifest V3's restrictions harm not only filtering quality and user experience, but also the filter development community. Previously, anyone could create a filter for themselves, and over time such a filter could become popular and get on the list of recommended blockers. Now it is much more difficult to accomplish this. After all, blockers must use pre-set filters (no more than 50), and we have to be very selective about which filters will be available to users. Of course, you can still set your own filter manually. But don't forget the 5000 rule limit on all custom filters and user rules.

The further description of the problems includes a lot of details, mostly understandable to developers. If you're not a techie, you can feel free to skip this part.

Declarative rules

Before Manifest V3 was introduced, the filtering engine was dynamically built from filters downloaded from the server by the extension. Further, the rules which made up the filters were applied at different stages of page loading.

For example, rules could have been triggered before the browser sends the request: within the onBeforeRequest event, the browser asked the extension what to do with a particular request, and the extension reacted dynamically by blocking or redirecting it. The cosmetic rules were applied a little later, when the page was already loaded and the DOM appeared.

Now that Manifest V3 has taken effect, the onBeforeRequest method can no longer be applied. Instead, Chrome suggests using the declarativeNetRequest API, with which the right to modify requests is given to the browser. The extension only announces a set of declarative rules according to which the browser will modify or block network requests.

Declarative rules syntax

The syntax for declarative rules is quite different from the syntax commonly used by modern ad blockers. Many members of the community will probably give up working within Manifest V3 to avoid taking the time to create Chrome-only rules.

Each rule should consist of fields:

  • id – the identifier of the rule. It can be used to associate a declarative rule with a text rule.
  • priority – the priority of the rule. It determines how the rule will be applied to the query.
  • action – the action of a rule.
    are of three kinds:
    • block – actions that block requests.
    • redirect or upgradeScheme – actions that redirect requests.
    • allow or allowAllRequests – actions that allow requests.
  • condition – condition under which the rule is applied

Example rule:

{
  "id": 1,
  "priority": 1,
  "action": { "type" : "block" },
  "condition": {
    "urlFilter": "abc",
    "domains": ["example.org"],
    "resourceTypes": ["script"]
  }
}

This rule will block all requests to scripts that have an abc substring in their address and originate from the site with the domain example.org.

The current situation causes an acute sense of deja vu: when developing the ad-blocking extension for Safari, we had to work out a way to convert our rules syntax to the syntax imposed by the browser's developers. This time we're using a similar solution to turn our syntax into declarative Chrome rules.

To convert static and dynamic rules we added a module to our @adguard/tsurlfilter library. The library runs through the filter rules and converts them into declarative rules, then combines them into rulesets and stores them in .json files. The library builds a mapping table between text rules and JSON rules so that the connection between them is not lost.

A couple of examples of how the converter works:

The rule ||example.com^$script is converted to

{
    "id": 1,
    "action": {
        "type": "block"
    },
    "condition": {
        "urlFilter": "||example.com^",
        "resourceTypes": [
            "script"
        ],
        "isUrlFilterCaseSensitive": false
    }
}

The rule @@||example.com^$script$domain=example.org is converted to

{
    "priority": 1,
    "id": 23,
    "action": {
        "type": "allow"
    },
    "condition": {
        "urlFilter": "||example.com^$script",
        "initiatorDomains": [
            "example.org"
        ],
        "isUrlFilterCaseSensitive": false
    }
}

Most of the rules are converted correctly, but some functionality is lost because of various restrictions:

  • $removeparam does not support exclusions (~) and regular expressions (regexp)
  • For regular expressions, Chrome uses its own implementation of such expressions, so part of the standard functionality is not supported. For example, these are regular expressions containing backreferences, negative lookaheads, and possessive quantifiers.
  • negative lookahead is often used in filters. A quick search showed that there are currently 43 rules with this expression in AdGuard filters. At first glance, this is not many, but keep in mind that most of these rules are supposed to work on many different domains so I'd say this limitation alone cripples ad blocking on 1000+ websites.
  • Regular expressions are additionally validated within Chrome for the amount of memory consumed. Since we're not quite sure what kind of implementation is used in this case, there may be some problems with some regular expressions.
  • Cookie rules are not supported.
  • There are many more issues that we have not mentioned here to not pollute the post.

The problem with declarative rules is rather obvious: their syntax severely limits what our extension can do. And, frustratingly, there is nothing we can do about it, other than hope that the Chrome developers will improve it over time.

Rulesets

According to the new API, declarative rules must be combined into rulesets.

An example of integrating a ruleset in Manifest V3:

{
  "name": "AdGuard AdBlocker MV3",
  "version": "1",
  "declarative_net_request": {
     "rule_resources": [{
       "id": "ruleset_1",
       "enabled": true,
       "path": "rules.json"
     }]
   },
   …
}

Rulesets are specified in the manifest.json file and are loaded only when the extension is installed or updated. And this is also a huge problem. Sometimes a filtering rule breaks the layout or performance of one or several websites. With such an incredibly high amount of rules, it is almost impossible statistically to completely avoid such incidents. To add to that, websites are constantly changing, and rules that used to be fine earlier might cause issues now. But that's fine: we had a simple solution for this problem.

Imagine that such a rule is in the filter and you need to disable it quickly. In Manifest V2 extension, modifier $badfilter was used for this purpose. Filter developers would add a rule with the specified modifier, the extension would get updated dynamically, the new rule would disable the referred rule, and things would get better. As you understand, this "trick" won't work with Manifest V3.

Now you can expect filters not to be updated for several days on end: after adding the new version to the Chrome Store, you need to wait for the review to be passed. Sadly, there is no other way to provide users with updated filters. The discussion about the ability to enable and disable individual rules gives some hope. There is a small chance that extensions will be given the functionality to update filters quickly after all.

Stats and filtering log

AdGuard Browser extension, based on Manifest V2, has a filtering log that shows all the requests sent by your browser and detailed information about them. In particular, you can see which filtering rule was used to block this or that rule.

Due to the fact that Chrome itself now blocks requests and shares statistics only with extensions unzipped and installed in Developer Mode, we can't implement the filtering log as we used to. But we can come up with a peculiar alternative, which we plan to do in the final version of the extension.

So, when you open the filtering log, an engine that works by the rules of Manifest V2 will be launched. It won't do anything with the requests, only show which rules may have been applied. By comparing the Chrome statistics with the results of the old engine, we will get a rough picture of how requests are processed.

The current version of the prototype does not implement a filtering log. Instead, filter developers will have to use the mechanism recommended by Chrome developers. The point is that you can still get information about which rule triggered. But there is a caveat: you need to install the extension in an "unpacked" form. That is, you will need to clone our repository, "build" the extension, switch the browser to Developer Mode, and only in this case you will be able to use the tools for debugging filters.

Filtering log

Service worker

With Manifest V3, the background page is gone. The background page is a separate background process where extensions could maintain their state and work with the browser APIs (like beforementioned onBeforeRequest). In Manifest V3, this page is replaced by a service worker, which is often interrupted by the browser.

When the browser stops the service worker, the extension goes into a kind of sleep mode: the declarative rules work, but the cosmetic rules that are loaded dynamically do not. For the extension to be functional, something must wake up the service worker: it can be loading a page or a message that has been sent to the service worker.

When the service worker is waking up, the extension starts to read filtering rules from the repository and process them so that it can then find them quickly. During this time, for 1.5-2 seconds, the extension does not apply cosmetic filtering, but ad requests are blocked by the browser itself. Then the engine launches and the ads disappear. We plan to reduce the wake-up time of the service worker and strive to move most of the cosmetic rules to the content script (which works in the context of the web page and is not getting killed every minute), but for some cases we will still need the service worker.

Conclusion

Despite the limitations of Manifest V3, AdGuard MV3 still protects against ads and tracking quite well:

  • Blocks requests to trackers proactively
  • Hides banners, social widgets and other annoying elements
  • Blocks adverts on video sharing platforms, including YouTube

Although the experimental extension is not as effective as its predecessor, most users won't feel the difference. The only thing you might notice is ad flickering due to the lag in the application of cosmetic rules.

Our goal with this prototype is to test the new approach and get your feedback. So please, try it out and let us know what can be improved. As usual, this prototype is open source and published on Github. If you have any issue with it or have any suggestion, please post it to Github and we will listen.

By releasing an extension built with Manifest V3 today — first among developers of ad blockers – we can say that we've met the challenge that Google posed to us. There is still a lot of work to be done, but we can already claim that even after the discontinuation of Manifest V2, Google Chrome users will be able to protect themselves from ads and trackers with the AdGuard Browser Extension.

Líbil se vám tento příspěvek?
AdGuard VPN AdGuard DNS AdGuard Mail AdGuard Wallet
AdGuard VPN AdGuard DNS AdGuard Mail AdGuard Wallet
Hlavní obrazovka AdGuard pro Windows
Obrazovka Ochrana v aplikaci AdGuard pro Windows, zobrazující funkce a nastavení ochrany
Obrazovka Statistik aplikace AdGuard pro Windows zobrazující statistiky blokovaných reklam a sledovacích prvků
Obrazovka Správa aplikací AdGuard pro Windows, zobrazující možnosti správy ochrany pro aplikace nainstalované na zařízení
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard: blokovač reklam pro Windows

AdGuard pro Windows je víc než jen blokátor reklam. Je to víceúčelový nástroj, který blokuje reklamy, řídí přístup k nebezpečným webům, zrychluje načítání stránek a chrání děti před nevhodným obsahem
Stažením programu přijímáte podmínky Licenční smlouvy
Microsoft Store
Stažením programu přijímáte podmínky Licenční smlouvy
AdGuard pro Windows v8.0, 14-denní zkušební verze
Hlavní obrazovka AdGuard pro Mac
Obrazovka režimu utajení aplikace AdGuard pro Mac
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard: blokovač reklam pro Mac

AdGuard pro Mac je jedinečný blokátor reklam navržený s ohledem na macOS. Kromě ochrany před obtěžujícími reklamami v prohlížečích a aplikacích vás chrání před sledováním, phishingem a podvody
Stažením programu přijímáte podmínky Licenční smlouvy
Čtěte dál
AdGuard pro macOS v2.19, 14-denní zkušební verze
Hlavní obrazovka AdGuard pro Android
Obrazovka Ochrana před sledováním AdGuard pro Android
Obrazovka Správa aplikací AdGuard pro Android, zobrazující možnosti správy ochrany pro aplikace nainstalované na zařízení
Obrazovka Statistiky aplikace AdGuard pro Android zobrazující statistiky blokovaných reklam a sledovačů
Hlavní obrazovka soukromého prohlížeče AdGuard pro Android
QR kód pro stažení AdGuardu pro Android
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard: blokovač reklam pro Android

Blokuje reklamy a sledovací prvky ve všech prohlížečích, hrách a dalších aplikacích. Chrání vaše soukromí a umožňuje vám kontrolovat, jak vaše aplikace používají internet. Instalováno pomocí APK
Stažením programu přijímáte podmínky Licenční smlouvy
Čtěte dál
Naskenovat a stáhnout
Použijte libovolnou čtečku QR kódů dostupnou ve vašem zařízení
AdGuard pro Android v4.14, 14-denní zkušební verze
Hlavní obrazovka AdGuard pro iOS
Obrazovka Ochrana aplikace AdGuard pro iOS, zobrazující funkce ochrany a nastavení
Obrazovka Statistik aplikace AdGuard pro iOS, zobrazující statistiky blokovaných reklam a sledovacích prvků
QR kód pro stažení AdGuard pro iOS
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard: blokovač reklam pro iOS

Nejlepší blokátor reklam pro iOS na iPhone a iPad. AdGuard odstraňuje všechny druhy reklam a sledovacích prvků v Safari a chrání vaše soukromí ve všech aplikacích na úrovni DNS
Stažením programu přijímáte podmínky Licenční smlouvy
Čtěte dál
Naskenovat a stáhnout
Použijte libovolnou čtečku QR kódů dostupnou ve vašem zařízení
AdGuard pro iOS v4.5
Hlavní obrazovka AdGuard Content Blocker
Obrazovka filtrů AdGuard Content Blocker
Obrazovka nastavení AdGuard Content Blocker
20 466 20466 uživatelských recenzí
Vynikající!

Blokátor obsahu AdGuard

Blokátor obsahu AdGuard eliminuje všechny druhy reklam v mobilních prohlížečích, které podporují technologii blokování obsahu — jmenovitě Samsung Internet a Yandex. Browser. Je více omezen než AdGuard pro Android, ale je zdarma, snadno se instaluje a stále poskytuje vysokou kvalitu blokování reklam
Stažením programu přijímáte podmínky Licenční smlouvy
Čtěte dál
Blokátor obsahu AdGuard v2.8
Hlavní obrazovka Rozšíření prohlížeče AdGuard
Obrazovka Ochrana před sledováním Rozšíření prohlížeče AdGuard
20 466 20466 uživatelských recenzí
Vynikající!

Rozšíření prohlížeče AdGuard

AdGuard je nejrychlejší a nejlehčí rozšíření pro blokování reklam, které účinně blokuje všechny typy reklam na všech webových stránkách! Vyberte si AdGuard pro prohlížeč, který používáte a získejte rychlé a bezpečné prohlížení bez reklam.
Instalovat
Stažením programu přijímáte podmínky Licenční smlouvy
Instalovat
Stažením programu přijímáte podmínky Licenční smlouvy
Instalovat
Stažením programu přijímáte podmínky Licenční smlouvy
Instalovat
Stažením programu přijímáte podmínky Licenční smlouvy
Instalovat
Stažením programu přijímáte podmínky Licenční smlouvy
Čtěte dál
Instalovat
Stažením programu přijímáte podmínky Licenční smlouvy
Čtěte dál
Rozšíření prohlížeče AdGuard v5.5
Hlavní obrazovka AdGuard Assistant
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard asistent

Doplněk prohlížeče pro desktopové aplikace AdGuard. Umožňuje blokovat vlastní položky na webových stránkách, přidávat webové stránky do seznamu povolených a odesílat hlášení přímo z prohlížeče
AdGuard asistent v1.4
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard Home

AdGuard Home je síťové řešení pro blokování reklam a slídičů. Nainstalujte jej jednou na svůj router a pokryjete všechna zařízení ve své domácí síti — není třeba žádný další klientský software. To je obzvláště důležité pro různá zařízení IoT, která často představují hrozbu pro vaše soukromí
AdGuard Home v0.107
Hlavní obrazovka AdGuard Pro pro iOS
Obrazovka ochrana AdGuard Pro pro iOS, zobrazující funkce ochrany a nastavení
Obrazovka statistiky AdGuard Pro pro iOS, zobrazující statistiky pro Zablokováno reklamy a slídiče
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard Pro pro iOS

AdGuard Pro pro iOS obsahuje všechny pokročilé funkce blokování reklam s povolenou ochranou. Nabízí stejné nástroje jako placená verze AdGuard pro iOS. Vyniká blokováním reklam v Safari a umožňuje upravit DNS nastavení, abyste si mohli ochranu přizpůsobit na zakázku. Blokuje reklamy v prohlížečích a aplikacích, chrání vaše děti před nevhodným obsahem a udržuje vaše osobní data bezpečná
Stažením programu přijímáte podmínky Licenční smlouvy
Čtěte dál
AdGuard Pro pro iOS v4.5
Hlavní obrazovka AdGuard Mini pro Mac
Obrazovka ochrany Safari AdGuard Mini pro Mac
Obrazovka Vytvořit pravidlo AdGuard Mini pro Mac
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard Mini pro Mac — blokátor reklam pro Safari

AdGuard Mini pro Mac je výkonný blokátor reklam v Safari. Tato malá aplikace odstraňuje reklamy, blokuje slídiče a zrychluje načítání stránek. Pomáhá vám procházet web v Safari bez rušivých vlivů a zachovávat soukromí vašich dat
Instalovat
Stažením programu přijímáte podmínky Licenční smlouvy
Čtěte dál
AdGuard Mini pro Mac v2.3
Hlavní obrazovka AdGuardu pro Android TV se zapnutou ochranou
Obrazovka blokování reklam aplikace AdGuard pro Android TV, zobrazující její funkce a nastavení
Obrazovka nastavení aplikace AdGuard pro Android TV
Obrazovka správy aplikací AdGuardu pro Android TV, zobrazující aplikace, ve kterých jsou blokovány reklamy a sledovací prvky
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard pro Android TV

AdGuard pro Android TV je jediná aplikace, která blokuje reklamy, chrání vaše soukromí a funguje jako firewall pro chytrou TV. Získejte varování před webovými hrozbami, používejte zabezpečený DNS a využívejte šifrovaný provoz. Uvolněte se a ponořte se do svých oblíbených pořadů se špičkovým zabezpečením a žádnými reklamami!
AdGuard pro Android TV v4.14, 14-denní zkušební verze
Maskot AdGuardu, Agnar, držící linuxového tučňáka
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard pro Linux

AdGuard pro Linux je první systémový blokátor reklamy pro Linux na světě. Blokujte reklamy a slídiče na úrovni zařízení, vyberte si z předinstalovaných filtrů nebo si přidejte vlastní — to vše prostřednictvím rozhraní příkazového řádku
AdGuard pro Linux v1.4
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard Temp Mail

Bezplatný generátor dočasných e-mailových adres, který vás udržuje v anonymitě a chrání vaše soukromí. Žádný spam ve vaší hlavní doručené poště!
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard VPN

75 umístění po celém světě

Přístup k jakémukoliv obsahu

Silné šifrování

Žádné záznamy aktivit

Nejrychlejší připojení

Podpora 24/7

Vyzkoušet zdarma
Stažením programu přijímáte podmínky Licenční smlouvy
Čtěte dál
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard DNS

AdGuard DNS je alternativní řešení pro blokování reklam, ochranu soukromí a rodičovskou kontrolu. Jednoduché nastavení a bezplatné používání poskytuje potřebné minimum ochrany proti online reklamám, slídičům a phishingu bez ohledu na to, jakou platformu a zařízení používáte.
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard Mail

Chraňte svou identitu, vyhněte se spamu a zabezpečte svou e-mailovou schránku pomocí našich aliasů a dočasných e-mailových adres. Využijte naši bezplatnou službu přeposílání e-mailů a aplikace pro všechny operační systémy
20 466 20466 uživatelských recenzí
Vynikající!

AdGuard Wallet

Bezpečná a soukromá kryptopeněženka, která vám dává plnou kontrolu nad vaším majetkem. Spravujte více peněženek a objevte tisíce kryptoměn, které můžete ukládat, posílat a vyměňovat
Stahování AdGuardu Chcete-li nainstalovat AdGuard, klikněte na soubor označený šipkou Vyberte „Otevřít“ a klikněte na tlačítko „OK“, poté počkejte, než se soubor stáhne. V otevřeném okně přetáhněte ikonu AdGuardu do složky „Aplikace“. Děkujeme, že jste si zvolili AdGuard! Vyberte „Otevřít“ a klikněte na tlačítko „OK“, poté počkejte, než se soubor stáhne. V otevřeném okně klikněte na tlačítko „Instalovat“. Děkujeme, že jste si zvolili AdGuard!
Nainstalujte si AdGuard i pro mobilní zařízení