Safari Web Extensions: what can users of Safari content blockers expect from the new Apple's initiative
If you just want the gist, here's a TLDR: Safari adopts the most common and widely used browser extension API, but not before they remove a bunch of content blocking-related features from there. In its current form it's useless for ad blocker developers, and only time will tell if things will get better.
Apple is currently actively developing the next version of Safari that will appear in macOS Big Sur. Most changes can already be seen and tested in the official beta of Safari 14, and one that is of special interest to the users of ad blockers is WebExtensions support.
But what is WebExtensions? It's an API (application programming interface) for developing browser extensions that can alter the behavior and appearance of your browser. Many popular browsers like Chrome, Mozilla and Edge support WebExtensions API, but Safari has stayed away from it, requiring developers to use a different set of APIs. Because of that, migrating an extension from, say, Chrome to Safari takes a lot of effort, and many developers don't have the resources to do so. As a result, Safari has been missing out on numerous extensions that are available for other browsers.
This June, at Worldwide Developers Conference (WWDC2020), Apple announced that Safari 14 will support WebExtensions. To many developers this came as a pleasant surprise. Among others, we support this decision; however, not much will change in terms of ad blocking in Safari, and here's why.
Back in 2015 Safari introduced the so-called Safari Content Blocking API. You guessed from its name that it serves to help developers build content blocking applications for Safari. AdGuard uses it too, in AdGuard for iOS, AdGuard Pro for iOS and AdGuard for Safari. Compared to WebExtensions, this API has several substantial drawbacks: it's limited in its capabilities and barely improves over time. That said, this API is just enough to provide an acceptable level content blocking.
Alright, but now everything's going to be different, isn't it? And we will surely migrate our Chrome/Firefox extensions to Safari? Unfortunately, no. There are a few serious roadblocks. The thing is, Safari developers didn't just copy WebExtensions API. Parts of functionality implied by WebExtensions will not be available in Safari 14. For example, you won't find an option to block web requests there. You can try: open the official documentation and search for "webRequest". That's what you'll find:
webRequest
BlockingResponse not supported.
Blocking requests not supported.
Even without any special knowledge you can guess what it means.
So what will happen next? Is there a chance that things will take a turn for the better? What awaits Safari content blockers in the future? Frankly, we don't have a clue.
On the one hand, we have this old stagnating Safari Content Blocking API. We've reported countless bugs and made more feature requests than there are apples on a fruit stand. They all remain ignored for years. From conversations we had with Apple developers we understand that they in principle aren't opposed to reviewing our implementation of Safari Content Blocking API, should we suggest it. But they, of course, give no promises about accepting it, so we don't press the issue, as it's a solid amount of work for no guaranteed result.
On the other hand, in theory they might take the further development of WebExtensions API seriously and eventually add an option to block web requests with its help. To be honest, it doesn't seem particularly likely that the situation will evolve in this direction. Although we must say, nobody really expected the announcement of WebExtensions support at WWDC in the first place, so there's always a chance. We all will have to wait and see.
And for now you have a couple of options:
- Install AdGuard for Safari. It squeezes out the best possible filtering quality from what Safari Content Blocking API has to offer.
- Install AdGuard for Mac. This is a premium product and it requires a license key after your trial period expires, but it laughs in the face of any artificial browser-specific restrictions. It blocks ads and tracking better than any browser extension ever could.