Apple’s Hidden WWDC Gem: Ad-blocking for iPhone

Justin Sullivan/Getty Images

Justin Sullivan/Getty Images

Apple revealed a lot about the new capabilities it’s planning for your favorite devices at its Worldwide Developers Conference (WWDC). But beyond the surprises and disappointments of Apple’s keynote at the conference, perhaps the most significant development was unveiled within the developer documentation for Safari 9.0. It was spotted by Joshua Benton, who reported for Harvard’s Nieman Lab that ad-blocking is coming to the iPhone with iOS 9.

Ad-blocking, which involves running a piece of software in your web browser to block ads on most web pages from loading, has gone mainstream in recent years. Until now, most adblocking has been limited to desktop browsers, as mobile browsers haven’t allowed it. But a section of the documentation, titled “Content Blocking Safari Extensions,” explains how that’s changing with Safari in iOS 9:

The new Safari release brings Content Blocking Safari Extensions to iOS. Content Blocking gives your extensions a fast and efficient way to block cookies, images, resources, pop-ups, and other content.

Your app extension is responsible for supplying a JSON file to Safari. The JSON consists of an array of rules (triggers and actions) for blocking specified content. Safari converts the JSON to bytecode, which it applies efficiently to all resource loads without leaking information about the user’s browsing back to the app extension.

Xcode includes a Content Blocker App Extension template that contains code to send your JSON file to Safari. Just edit the JSON file in the template to provide your own triggers and actions. The sample JSON file below contains triggers and actions that block images on

Apple Insider’s Roger Fingas reports that Xcode now includes a template for app extensions that supply a JSON file to Safari, which screens incoming Internet content without giving the browser history to the extension. Developers will only need to edit the JSON file to add triggers and actions. Fingas also notes that in the iOS 9 developer beta, the Safari menu now features an option for enabling and disabling individual content blockers.

The OS X version of Safari already allows a variety of custom extensions, and one featured prominently on Apple’s gallery of popular extensions is AdBlock. When iOS 9 launches in the fall, you’ll be able to go the App Store and download an extension that blocks ads on most sites. And Benton thinks that there isn’t much chance that such an extension won’t be incredibly popular, since it promises to make websites load more quickly, while using less data and removing intrusive and annoying ads.

While, in Benton’s estimation, the arguments for using ad blockers range from unconvincing to reasonable to understandable, but the “best reasons” for ad-blocking are even stronger on mobile, where bandwidth, performance, and battery life are at a premium. But the development should worry publishers, who make little ad revenue on mobile even as their readers shift from desktop to mobile in large numbers. Users of Safari — which StatCounter reports accounts for more than half of mobile and tablet browser usage in the United States — will soon be able to block ads with a simple, free download for the iPhone or iPad.

As for why Apple is enabling content-blocking extensions on the mobile version of Safari, there are several plausible arguments. Apple could be taking a natural step to give users more control of their iPhone experience and get serious about their privacy on the platform. The company could be undercutting its major competitor, Google, which makes more than 90% of its revenue from online advertising, a decent percentage of which is served to iPhones. Or the move could be tied to Apple’s newly-announced News app, which will bring a monetization model based on Apple’s iAds. It’s safe to assume that iAds won’t be blockable by third-party extensions from the App Store.

But as Apple’s documentation notes, the potential of “Content Blocking Safari Extensions” goes well beyond ads. Apple will also allow the blocking of cookies on a site-by-site basis, which would enable users to bypass the “paywalls” that the sites of newspapers, for example, put up. Benton projects that a developer could build an extension that blocks paywall cookies on the top 50 paid news sites. “It wouldn’t even be particularly hard to code; unless Apple chooses to prevent it, someone will do it.” That means that sites that rely on online advertising will need to rethink their revenue model as millions of people are installing ad-blockers and even mobile operators are thinking about implementing the technology.

Quartz’s Leo Mirani thinks that the extensions are less a doorway to AdBlock Plus and more the path to Ghostery, a popular browser extension that blocks all content pulled in from third-party servers. A modern website sends you some text and images when you navigate to one of its pages, but it also pulls data from “dozens of analytics tools, ad servers, ad exchanges, web analytics firms, social buttons and trackers, and various other forms of online surveillance that serve you ads, measure you responses, gauge your profile, figure out your shoe size, and so on.” Ghostery stops all of that incoming data, and Apple is enabling developers to create Safari extensions that do something similar.

More from Tech Cheat Sheet: