Content blocking in Safari 9 and iOS 9: good news? Or the death knell of ad blocking on Safari? · 2015-06-10 16:29 by Sebastian Noack

Apple recently announced a new mechanism for Safari and iOS extensions to block content. This is the first time since Safari 5.1 that new extension APIs have been added to Safari, so it was a nice surprise. We appreciate and support Apple’s attempts to finally catch up on extensions, but those latest changes will create either the best possible landscape for Safari extensions, or the worst – especially for Adblock Plus.

In short, either this new API will improve Adblock Plus performance on Safari or it will force us to rely upon an inferior blocking format that would essentially kill ad blocking on Safari.

So far very little is known about Content Blocking Extensions, available in Safari 9 and iOS 9. However, according to the announcements there are so called “block lists”, which are JSON files, that can be registered by the extension. Those lists are not (yet) documented but the announcement includes an example:

[
    {
        "action": {
            "type": "block"
        },
        "trigger": {
            "url-filter": "webkit.org/images/icon-gold.png"
        }
    },
    {
        "action": {
            "selector": "a[href^=\"http://nightly.webkit.org/\"]",
            "type": "css-display-none"
        },
        "trigger": {
            "url-filter": ".*"
        }
    }
]

This mechanism is entirely different from the one used by Adblock Plus on any other platform (including current versions of Safari), where we can run arbitrary code on request, blocking requests depending on their URL and context.

With this new mechanism, we’d need to convert Adblock Plus filter lists to a block list like the one above. However, most of our filters aren’t as simple as the example above. So, we are nervously awaiting how powerful their block lists will be, most importantly when it comes to matching the document domain and request type, as well as regular expression matching of URLs and recursive exception rules.

The best case is that the new API will help us to improve the performance and ad blocking experience on Safari, and paves the way for an iOS ad blocker. If their block list format turns out to be useless, however, that could mean the end of ad blocking on Safari, as the old mechanism relying on the onbeforeload DOM event and safari.self.tab.canLoad will get deprecated now.

Update (2015-06-11): Apparently, some sources, including the Guardian, TechRadar and Gizmodo, misinterpreted this blog post. They mistakenly report that Safari 9 and iOS 9 come with a content blocking feature that would make Adblock Plus redundant. However, this is not the case. Content Blocking Extensions are merely an API allowing developers to implement extensions like Adblock Plus in an efficient way. We are not crying about Apple taking over our business. They don’t. We merely pointed out that the new API they are going to provide us with, which eventually is going to replace the old one, might be inferior and putting ad blocking in general – not only in our case – at risk.

Update (2015-06-14): An article with details on the new content blocking mechanism has just been published on the WebKit website. But as we suspected, in it’s current state there are still some issues, which render Content Blocking Extensions insufficient, as outlined in our email to the WebKit mailing list.

Tags:

Comment [10]

  1. Higa · 2015-06-10 16:48 · #

    I just wanted to mention about this on twitter to you. I hope this will not get out of the beta. Then ABP will take over iOS for sure!!!!

    Reply from Sebastian Noack:

    Apparently, the iOS API isn’t even working yet. But even then, it’s still unknown (until Apple provides some documentation) whether that API is sufficient for ad blocking.

  2. Aaron · 2015-06-11 03:13 · #

    It seems a little heavy handed of Apple to deprecate onbeforeload and canLoad. I hope that Apple aggressively keeps up with new ways of blocking content by adding new APIs each year.

    The great news about this (besides finally being able to block ads in Safari) is that I suspect that using this native content blocker has huge performance advantages over trying to block things with JavaScript.

    Also, if you’ve got ads being inserted by JavaScript, using a native content blocker like this seems useful too, because you don’t need to listen on every DOM change and run things against a filter list; it’s happening at a lower level of abstraction.

  3. blix · 2015-06-11 17:06 · #

    There are a lot of good solutions to block ads already on App Store.
    My very favorite is Weblock. Blocks ads in Safari AND all kind of apps, which this method is short on.

    Reply from Sebastian Noack:

    Interesting. Apparently, they use a dummy DNS server. This approach however is quite limited. Adblock Plus relies on more powerful mechanisms to block ads more reliable.

  4. Harry Zink · 2015-06-11 20:32 · #

    (Note: the blog comments ideally should use the forum login info, to prevent having to provide the same information again)

    iOS 9 is in beta. You’re a developer. Particularly the developer of the #1 ad blocking tool. As such, work with Apple on improving whatever API mechanism they currently have in place.

    ABP would and should dominate iOS 9 ad blocking when iOS 9 releases – particularly if there were a means to use iCloud to share configurations between devices.

    Reply from Sebastian Noack:

    (Yeah, that would be a nice feature but not quite feasible, as we use different software, that is Textpattern for the blog, and currently phpBB for the forum)

    We would certainly be interested in cooperating with Apple to improve ad blocking on Safari, and bringing it to iOS. The objective of this blog post was to get their attention.

  5. Harry Zink * · 2015-06-11 23:45 · #

    Great.

    You do realize, though, that they would never start a dialog via this blog or forum – that’d be against their DNA. ;-)

    Your best opportunities and chances would be to engage them directly – and I mean as directly as you can think of.

    Then you’d be cooking with water.

    Reply from Sebastian Noack:

    I don’t expect them to show up in the comments here or on the forum. However, it’s pretty hard to reach the right people at Apple. So we hope that they got aware of our concerns now, and reach out to us, or at least address our concerns.

  6. Plug · 2015-06-13 20:32 · #

    See https://www.webkit.org/blog/3476/content-blockers-first-look/.

    (They’re even taking questions on Twitter.)

    Reply from Sebastian Noack:

    Thanks for sharing. That article looks like a response to this blog post. While it confirms some of our concerns, we appreciate their call for feedback. I’ve sent an email to their mailing list.

  7. soichi · 2015-06-15 15:14 · #

    Please don’t give up on content blockers on iOS 9! I love ABP and ever since Google made it difficult to use ABP on Android it’s made me really upset. I hate intrusive ads! The thought that Apple is opening up Webkit to enable content blocking in iOS 9 was like a light at the end of the dark tunnel. Please don’t give up on them and work with them to help them improve the content blocking features for safari!

    Reply from Sebastian Noack:

    No worries, we didn’t give up. But it’s up to Apple to address our feedback now, that we can actually use the new API in Safari 9 and iOS 9.

  8. Laure Poutchini · 2015-06-23 09:46 · #

    A very interesting post ! It give a great service for us !

  9. George · 2015-07-15 21:05 · #

    Are you people kidding me, people? Do you really think Apple or Google or any multinational pack of psychos like that care a single iota of a rats sh*t about blocking anything? Do we all have collective amnesia? We all know about massive government surveillance. Google and Apple work with the NSA or whoever else to implement “features” that compromise our security and privacy all the time. For no reason google disallows abp in the store? Please. There are documentaries and papers about this and even a bloody pwntopwn presentation. You’re dealing with psycho scum here. And then some pieces of crap online “journalists” get paid to write articles talking about how ABP is affecting revenue when many ads are malicious! Many ads are MALICIOUS. I routinely fix people’s computers that have tons of pop ups and ad banners. I swear by god, please, yet another article say how bad ABP is. Please. I will fly to your head office, puncture all the tires and etch an ABP logo into the back of every car in your parking lot.

    Reply from Sebastian Noack:

    We are talking about Apple, not Google, here. Apple’s business model isn’t focused on ads or spying on users. After all, they are introducing that new API, this article is about, in an attempt to improve content blocking functionality on their platform. Though it has some issues.

  10. Liam · 2015-07-19 02:43 · #

    Any updates from Apple? Does it seem like it will be able to work out?

    Reply from Wladimir Palant:

    Well, it’s Apple – they received our feedback but they aren’t exactly known for keeping the dialog going.

Commenting is closed for this article.