Skip to content

Instantly share code, notes, and snippets.

@velzie
Last active June 25, 2024 17:13
Show Gist options
  • Save velzie/053ffedeaecea1a801a2769ab86ab376 to your computer and use it in GitHub Desktop.
Save velzie/053ffedeaecea1a801a2769ab86ab376 to your computer and use it in GitHub Desktop.
How to keep using adblockers on chrome and chromium

How to keep using adblockers on chrome and chromium

  1. google's manifest v3 has no analouge to the webRequestBlocking API, which is neccesary for (effective) adblockers to work
  2. starting in chrome version 127, the transition to mv3 will start cutting off the use of mv2 extensions alltogether
  3. this will inevitably piss of enterprises when their extensions don't work, so the ExtensionManifestV2Availability key was added and will presumably stay forever after enterprises complain enough

You can use this as a regular user, which will let you keep your mv2 extensions even after they're supposed to stop working

Linux

In a terminal, run:

sudo mkdir -p /etc/opt/chrome/policies/managed /etc/opt/chromium/policies/managed
echo '{ "ExtensionManifestV2Availability": 2 }' | sudo tee /etc/opt/chrome/policies/managed/policy.json /etc/opt/chromium/policies/managed/policy.json

ChromeOS

  • enable developer mode
  • upon rebooting, go into vt2 (shift+ctrl+right arrow function key)
  • log in as root
  • type in /usr/libexec/debugd/helpers/dev_features_rootfs_verification && reboot
  • upon rebooting, go into vt2 again and log in as root
  • run the commands from the linux section

Windows

Open regedit, and create Software\Policies\Google\Chrome\ExtensionManifestV2Availability in HKEY_LOCAL_MACHINE as a dword set to 0x00000002

MacOS

In a terminal, run: defaults write com.google.Chrome ExtensionManifestV2Availability 2

(note that i haven't tested this for mac. please let me know if it doesn't work)

@Technetium1
Copy link

Technetium1 commented Jun 6, 2024

ChromeEnableManifestV2.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Policies\Google\Chrome]
"ExtensionManifestV2Availability"=dword:00000002
; Only works until June 2025

You can do the same for other browsers by adding the relevant keys seen at: https://old.reddit.com/r/browsers/comments/119x3qo/enabling_manifestv2_and_certain_external/

@rwilsonncsa
Copy link

Linux instructions need this:
sudo mkdir -p /etc/opt/chromium/policies/managed

@mary-ext
Copy link

mary-ext commented Jun 7, 2024

worth noting that uBO Lite is pretty good. despite the Lite moniker, it's not that much weaker, there's only a small percentage of unsupported filters. you can't add custom filters or filter lists via the extension, but you can always build uBlock from source, not much tooling involved. run make mv3-chromium after cloning the repository, and install the resulting extension

I've daily-driven it for a while and have been impressed at how far gorhill was able to take it, I'd probably even consider using it on Firefox if not for the above caveat.


EDIT: partial logs that shows the processing done on filters

Default filterlist
Version: 2024.6.8.134
Secret: 2cb75976600b7431
============================
Listset for 'default':
	Fetching remote https://ublockorigin.github.io/uAssets/filters/unbreak.min.txt
	Fetching remote https://ublockorigin.github.io/uAssets/filters/privacy.min.txt
	Fetching remote https://ublockorigin.github.io/uAssets/filters/quick-fixes.min.txt
	Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easylist.txt
	Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easyprivacy.txt
	Fetching remote https://ublockorigin.github.io/uAssets/filters/filters.min.txt
	Fetching remote https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext
	Fetching remote https://ublockorigin.github.io/uAssets/filters/ubol-filters.txt
	Fetching remote https://ublockorigin.github.io/uAssets/filters/badware.min.txt
Input filter count: 123080
	Accepted filter count: 121778
	Rejected filter count: 143
Output rule count: 16373
	Pruning requestDomains: from 83752 to 83536
	Pruning requestDomains: from 3401 to 3398
	Pruning requestDomains: from 5759 to 5755
	Fetching remote https://ublockorigin.github.io/uAssets/dnr/default.json
	Plain good: 14697
	Maybe good (regexes): 173
	redirect=: 347
	removeparams= (accepted/discarded): 51/12
	modifyHeaders=: 59
	Unsupported: 1046
CSS-generic: 13580 plain CSS selectors
CSS-generic-high: 527 plain CSS selectors
CSS-specific: 11224 distinct filters
	Combined into 10414 distinct hostnames
	Combined into 495 distinct entities
CSS-declarative: 493 distinct filters
	Combined into 875 distinct hostnames
	Combined into 51 distinct entities
Procedural-related distinct filters: 804 distinct combined selectors
	Combined into 988 distinct hostnames
	Combined into 95 distinct entities
My own filterlist
Version: 2024.6.8.142
Secret: 5180f77e03741eda
============================
Listset for 'default':
        Fetching remote https://ublockorigin.github.io/uAssets/filters/filters.min.txt
        Fetching remote https://ublockorigin.github.io/uAssets/filters/badware.min.txt
        Fetching remote https://ublockorigin.github.io/uAssets/filters/privacy.min.txt
        Fetching remote https://ublockorigin.github.io/uAssets/filters/unbreak.min.txt
        Fetching remote https://ublockorigin.github.io/uAssets/filters/quick-fixes.min.txt
        Fetching remote https://ublockorigin.github.io/uAssets/filters/ubol-filters.txt
        Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easylist.txt
        Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easyprivacy.txt
        Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easylist-cookies.txt
        Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easylist-social.txt
        Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easylist-chat.txt
        Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easylist-newsletters.txt
        Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easylist-notifications.txt
        Fetching remote https://ublockorigin.github.io/uAssets/filters/annoyances-cookies.txt
        Fetching remote https://ublockorigin.github.io/uAssets/thirdparties/easylist-annoyances.txt
        Fetching remote https://raw.githubusercontent.com/ABPindo/indonesianadblockrules/master/subscriptions/abpindo.txt
Input filter count: 128051
        Accepted filter count: 127582
        Rejected filter count: 73
Output rule count: 22421
        Pruning requestDomains: from 81485 to 81455
        Pruning requestDomains: from 3401 to 3398
        Pruning requestDomains: from 6862 to 6850
        Fetching remote https://ublockorigin.github.io/uAssets/dnr/default.json
        Plain good: 20743
        Maybe good (regexes): 174
        redirect=: 347
        removeparams= (accepted/discarded): 51/12
        modifyHeaders=: 59
        Unsupported: 1047
CSS-generic: 44807 plain CSS selectors
CSS-generic-high: 4719 plain CSS selectors
CSS-specific: 24518 distinct filters
        Combined into 33865 distinct hostnames
        Combined into 521 distinct entities
CSS-declarative: 573 distinct filters
        Combined into 6730 distinct hostnames
        Combined into 53 distinct entities
Procedural-related distinct filters: 827 distinct combined selectors
        Combined into 1012 distinct hostnames
        Combined into 95 distinct entities

@ThisIsADogHello
Copy link

Probably worth updating the Windows instructions to clarify that key goes under HKEY_LOCAL_MACHINE, since the current phrasing leaves its ambiguous whether it's HKLM, HKCU, or a secret third thing.

@Leah96xxx
Copy link

Does the Windows reg key also work for Opera GX? Or would that need a different key?

@trekshcool
Copy link

trekshcool commented Jun 24, 2024

Windows 11 here, there is no google in my HKEY_LOCAL_MACHINE Software\Policies\

Edit: I managed to make the keys/folders uptil Software\Policies\Google\Chrome\ and then tried to make the dword ExtensionManifestV2Availability but the dword does not seem to be able to accept 0x00000002

Edit 2: I removed the 0x and only put in 00000002 and it seems to have worked.

So basically if you dont have those folders make them yourself they are called keys in the new menu and then when you get to \chrome make a dword called ExtensionManifestV2Availability and set it to 00000002.

Please let me know if anything I did here is wrong. Thanks a lot for the guide!

@Technetium1
Copy link

@trekshcool You can also save the .reg file I put as the first comment. Double-clicking it will prompt to add the key.

@Leah96xxx Opera does not currently require a flag for override. I've updated my comment to include a link to the keys for other browsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment