Block all but a few domains
Is there easy way to set up filters to block all domains except a few?
Specifically what I'm trying to accomplish. I'm currently using Fluid to make custom apps (it wraps a UIWebView) for certain domains. For example facebook.com. In such a case it makes a browser that can only access facebook.com and no other domains. In my main browser, Chrome I have ublock origin blocking facebook.com which forces me to use the Fluid created custom browser (which is what I want to happen. I don't want my main browser accessing facebook.com)
I'd like to switch to using Chrome instead of Fluid and my first thought was I could start chrome with unique --user-data-dir directories and install ublock origin to solve the filtering.
I tried it with stackoverflow as a test and wrote this long filter /^((?!stackoverflow.com|ajax.googleapis.com|cdn.sstatic.net|i.stack.imgur.com|clc.stackoverflow.com).)*$/
It kind of worked but then when I tried to run a snippet I get an error for stacksnippets.net. I can add that to the long regex but was hoping to find an easier way. I tried going to stacksnippets.net directly and picking disable strict blocking for stacksnippets.net: permanently but that didn't fix the issue. I tried adding stacksnippets.net to the whitelist but that also didn't help
Is there a way to block everything and just whitelist a few places?
uMatrix, also made by gorhill, is set up with blocking almost everything in mind, I would try using it instead. Walkthrough Page
To set it to allow only facebook and block all other network connections you would disable everything under "hosts files" and clear out "my rules" > "temporary rules", then set it to this:
* * * block
* 1st-party * block
matrix-off: facebook.com true
commit to the changes and your done. you could also use uBlock on top to block anything on facebook that's unwanted.
How about hard blocking mode and "allow" for specific sites? Maybe it will work.
Closing and marking as invalid, as per CONTRIBUTING.