1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-05-06 21:33:33 +12:00
19 How to work only with global rules and all scripts blocked by default
Raymond Hill edited this page 2017-11-26 17:44:20 -05:00

The way you work your ruleset with uMatrix is not dictated by uMatrix. If you want to work strictly with global rules, i.e. rules that apply everywhere, uMatrix allows that.

Using an example page, this is uMatrix with out-of-the-box ruleset -- by default uMatrix is set up to work with per-base domain rules:

a

From there, we will set up uMatrix to work as follow:

  • All rules will be global.
  • All script and frame resources will be blocked by default.
  • Scripts and frames from a specific domain will be whitelisted/blacklisted with a single click on that domain.

First, select "Global" as the default scope in uMatrix's Settings:

a

From now on, the global scope will always be selected by default when you open the popup panel:

a

Now we will change the out-of-the-box ruleset to achieve our goal of working only with global rules and to only block/allow scripts and frames, i.e. everything else will be allowed by default. All these modifications to the default ruleset can be done from the popup panel:

a

As seen in the picture above:

  • The global scope is now always selected by default.
  • The cookie, media, XHR, and other cells were whitelisted.
  • The frame cell was un-blacklisted.
  • The 1st-party cell was un-whitelisted.
  • The 1st-party/frame cell was un-whitelisted.

Now persist these changes by clicking the padlock icon (which should report that 7 rules were changed):

a

This is it.

Scripts and frames are now blocked everywhere, and simply creating an allow rule directly on whatever domain will enable scripts and frames to be loaded for that domain. If you persist such rule by clicking on the padlock, they become permanently part of your ruleset, and applies everywhere since they are created in the global scope.

For example: create allow rules for googlevideo.com, youtube.com, and ytimg.com in the global scope (which is now always selected by default) and persist them with the padlock. You can now have embedded Youtube videos properly play on all sites:

a

If you care to deal with base domains only, then just collapse base domain sections by default:

b

You can expand specific base domain sections independently of the others if ever you want to set more granular subdomain-level rules.