Assumed audience: people interested in content blockers and privacy. What's this?
# Another Content Blocker?
The new content blocking extension APIs in WebKit were designed to solve this very problem by compiling the rules into an efficient bytecode format that executes for each request, eliminating the need to run custom scripts code to determine what should be blocked and what should not.
After trying out the new batch of content blocking extensions in the hope of finding a replacement for AdBlock, I decided to take matters into my own hands and start from scratch with an increased focus on performance and privacy.
# How it Works
Once Nope is enabled, every website you visit will fall into one of these three categories:
- Yep: Nothing is blocked.
- Nope: Third party resources belonging to any of the enabled categories (ads, tracking, social) are blocked. This is the default behavior.
- Mega Nope: All third party resources are blocked, regardless of whether they are on the rules list or not.
You can view a list of all the (sub)domains that you’ve already categorized in the settings accessible from Safari > Preferences > Extensions > Nope. It’s also possible to manually edit the comma-separated list to add new (sub)domains or remove existing ones.
You can set the behavior for a specific domain or subdomain using the toolbar button.
# API Limitations
Currently the content blocking APIs don’t expose the blocked resources to the extension. This means that there is no way of displaying what has been blocked outside of the Console logs in the developer console—not a great user experience for the average user.
Those who are happy to make this—hopefully temporary—tradeoff will see improved Safari performance, especially on sites that load dozens of third party scripts.
Logging blocked resources in the Safari Developer Console.
One of the goals that motivated me to work on Nope is to make an open-source blocking database that anyone can contribute to. Since the initial database I scrapped together ended up breaking a large number of popular sites, I opted for the open-source Disconnect database to get things off the ground more quickly. Going forward, I would like to drop this dependency and move the rules to a separate repository for more flexibility and transparency.