The Safari View Controller

Deep linking takes care of the situations where a link in an application redirects to Safari. However, there are other ways that developers can handle links in their applications. The other major method is one you’ll find in apps like Skype and Facebook, and it’s basically a mini web browser built inside the application. These built in web browsers traditionally used UIKit’s UIWebView class, which was subject to performance constraints when compared to mobile Safari. iOS 8 introduced the WKWebView class which was just as fast as Safari, but had some issues of its own that made it difficult to implement in many situations. While iOS 9 fixes many of the issues with WKWebView, such as lack of support for loading local files with the file://URL protocol, it also comes with a much better method for developers to handle the transition from their app to Safari. This new feature is called the Safari View Controller.

The main reason for Safari View Controller’s existence is to provide a better user experience than the existing miniature web browsers that applications have built in to them to handle web links. When an application handles the rendering of web pages on its own, the user loses access to many features of Safari like their password keychain, their stored credit card info, their cookies, and more. The obvious solution to this is to just use Safari, but that has traditionally come with the cost of moving the user out of their current application. This is certainly improved with the addition of the back link in iOS 9, but it would be much better if those mini web browsers could just be replaced by Safari running inside of an application. That’s essentially what Safari View Controller is.

When an application uses Safari View Controller to handle web content, the user will be presented with the interface above after clicking on a link. It’s very similar to Safari’s interface, but with a few alterations to let the user know what has happened. For starters, there’s a button in the upper right that says “Done”, which is a fairly obvious control to return to the application. The URL bar at the top is also greyed out, which indicates that you can’t change it. If you do want to start surfing the web, there’s a button in the bottom right to open the actual Safari application. Developers can also specify a custom tint color for the UI so users remember what application they’re working within.

While Safari View Controller gives the user access to all of their data like passwords, credit cards, and cookies, none of this information is provided to the host application. This is because Safari View Controller is actually running in a completely separate sandboxed application, which means that users don’t have to worry about the security of what they input or where they visit. This is also helpful for developers who don’t want to deal with the privacy implications of having users input into their own built in mini browser. What’s also useful for both developers and users is the ability to specify custom options in the Safari View Controller share sheet, such as a button that can share the current web page to a social network or to a contact via an instant message.

Since applications haven’t taken advantage of Safari View Controller yet it’s difficult to really communicate the advantages it provides. However, I think everyone can appreciate the improved user experience that comes with having access to all your web browser content in a safe and secure manner within any application. Since Safari View Controller also makes a developer’s life a lot easier by taking away the need to build a mini web browser UI, I think it will see significant and speedy adoption among new and existing applications.

Safari Content Blockers

I mentioned earlier in the review that Apple News ends up freeing you from the terrible ads, trackers, and slow JavaScript code of the modern web. However, the fact of the matter is that almost every user will have to use Safari or another web browser to do things on their phone, and most will use one on a daily basis. If your task isn't reading news, then Apple News can't protect you from the cruft of the web. One solution is to use native apps for websites, but it's hardly the case that every website offers their own app. The other solution is what we get in iOS 9, with a new Safari feature called Content Blockers.

Safari Content Blockers are extensions that provide Safari with a list of rules which defines content or resources on webpages that should not be shown or even loaded. The list of rules is written in JSON, and the syntax is simple enough that it really wouldn't be that difficult for most people to figure out how to make their own Content Blocker on their own. Having a relatively user-friendly syntax is also important because iOS 9 now allows you to sideload applications and extensions without having to pay the yearly $99 for an iOS developer account so long as you're compiling from source. This means that users can write and install their own Content Blocker with Xcode, or download and install an open source one from the web.

Pretend that you're reading AnandTech, and you're really annoyed at the Twitter sidebar on the right for whatever reason. You decide to write a Content Blocker to remove it, and the code for that blocker is what's shown in the Xcode project window above. As you can see, it's fairly readable code. The action applies the css-display-none attribute to page elements matching the selector, which is article.twitter in this case. For the trigger section we have the url-filter set to .* which means anything, as we want to indiscriminately eradicate every part of the Twitter feed. To make sure it doesn't affect content on other sites we tell it to only apply if the domain matches AnandTech.com or any of its subdomains.

Once you install an application that provides a Content Blocking extension, a new Content Blocker menu will appear in the Safari section of the settings app. In that menu you can enable or disable the Content Blockers that exist on your device. There's not much more to it once you enable the Content Blocker. If you were to install this and load any page on AnandTech the Twitter sidebar would be completely gone. It's worth noting that Content Blockers can only be installed on ARMv8 devices, which limits it to any device with Apple's A7, A8, or A8X SoCs.

While blocking specific content is one application of Content Blockers, you can create rules that apply to large swaths of content. The application that I'm sure many users are thinking of is blocking advertisements, and trackers. It is true that you can make Content Blockers to remove advertising, and I have no doubt that there will be ad blocking apps available very soon. As a writer, I can only do my job because this website is funded by advertising revenue, which would disappear if everyone blocked ads. At the same time, I recognize the fact that ads almost always come along with privacy violating tracking, garbage JavaScript code, and a long period of network activity which keeps your device's radio working and drains your battery. I'm not going to get involved in the debate about the ethics of ad blocking, but I did make an ad blocker for AnandTech to show what changes it makes to load times and page sizes.

The top image show a timeline of the network activity, page rendering, and JavaScript execution for the AnandTech home page without any advertisements or tracking scripts disabled. The bottom shows those same metrics when they are all blocked using a Content Blocker that is only a couple of lines longer than the one above I used to remove the Twitter sidebar. As you can see, the difference is absolutely enormous. Without Content Blocking it takes 1.43 seconds to just load in the core site content, which is over double the amount of time with Content Blockers. 1.43 seconds doesn't sound like a lot when it's not even one second longer, but it's extremely noticeable once you see how quickly the page loads with the blockers. There's also a 2.5MB reduction in data usage, and it's worth noting that there are sites that load even more than 3.5MB with ads. I'm not in the business of public shaming, but other people have already published the results of using Content Blockers on other websites and all I can say is that while 3.5MB is not amazing, it can get even worse.

The most shocking thing of all is the reduction in network traffic. With no ads firing trackers your network requests end when the page loads. Without the Content Blockers you can see that the network requests continue. The results vary, but I've seen it go as long as 25 seconds. Those 25 seconds are a period where your data is being used, and your radio is actively in use which is draining your battery without you even knowing it.

Like I said before, I'm not going to take a stance for or against adblocking. I will say that as a user, one never really gives explicit permission to be tracked, and it's just implied by your use of a service which makes it less clear to the user what exactly they're consenting to. I'll also say that the ad experience on the web is nothing short of terrible. If ad blocking becomes a big thing in mobile the publishers and ad networks are going to have to fix the intrusiveness and slowness of ads, or move inside applications like Apple News where another company that does know how to implement them in a user friendly manner can do it for them.

Under the Hood: UI Navigation, Input, App Thinning Final Words
Comments Locked

227 Comments

View All Comments

  • nafhan - Wednesday, September 16, 2015 - link

    Wrong. iPads get used by professionals (in addition to "prosumers") all the time for content creation tasks while on the go like music recording, viewing tablature, reviewing photos with clients, etc. Just because the content creation isn't happening on the tablet doesn't mean it's not getting used as part of a content creation workflow.

    That said: they are not a professionals primary content creation device. They're a secondary device that gets used when it's not reasonable to use the primary device for some reason.

    The Surface is going to fall into the same boat. Someone who does these types of content creation tasks is probably going to want something more powerful than Surface for their regular work. The iPad Pro and the Surface will both be used when the primary device is not available.

    Also, you are absolutely correct in that the vast majority of iPads (and computers) sold are as consumption devices. That's why the iPad mini exists!
  • superflex - Wednesday, September 16, 2015 - link

    Yikes.
    A koolaid fight has broken out and everyone is drunk on their brand of OS punch.
    You clowns are worse the the GPU fanbois.
    Makes reading the comments at AT a waste of time.
    Now get back to your respective OS shrines.
  • lilmoe - Wednesday, September 16, 2015 - link

    You're contradicting yourself;

    "Just because the content creation isn't happening on the tablet doesn't mean it's not getting used as part of a content creation workflow".

    That was exactly my point, and the point you emphasized in your last paragraph. iPads (even the lateset "Pro") can never be used for standalone, real professional work. The iPad "Pro" might be good for simple sketching at best... I mean, the new "pencil" doesn't even support hover or palm rejection, nor does the "Pro" run any full blown professional programs.

    There's nothing an iPad can do that a Surface can't (provided the mobile app is there). But the Surface can also replace laptops for many consumers, they can be the sole PCs of many prosumers, and they can be the mobile workstations of professionals because they can run the full blown programs their used to. Something iPads can never do.

    Android was never a real threat to iPads. However, while Apple isn't worried about the Surface series in particular, the real threat to iPads lies in Windows 10 and Universal Windows Platform.

    I can't wait for a Samsung made Wacom Windows 10 tablet with a Core M7.
  • nafhan - Wednesday, September 16, 2015 - link

    I'm not contradicting myself.
    Your argument seems to be that since it could be used as an all around replacement for every computer, professionals are using the Surface that way. My observation is that you are wrong. People who make money doing creative work generally don't have an MS based workflow, at all, and that even if they did, they'd probably still only use the Surface as a primary computer when absolutely necessary. If you're making money at your job and doing creative work, you're going to want a more powerful computer with more storage than the Surface as your main computer.

    I have a feeling that you have never worked with any professionals. They don't want Swiss Army knives. They want dedicated tools to get their work done easily and quickly. I'll sort of take that back: they do want the Swiss Army knife device, just as a secondary or tertiary device, not as a primary.
  • The-J-Man - Friday, September 18, 2015 - link

    This is changing. Some creatives are moving to Windows-based workflows as there are shifts in the industry, and Surface Pro is significant part of that. Ever since the first Surface Pro came out, the question among creatives is "Can it run Photoshop?" (Yes, it can.) Since that day, I think most creatives realize that iPads are consumption only. If you can have a tablet that is a presentation device that also lets you do actual work on a train or at a coffee shop between meetings, then isn't that better, even if it doesn't have iMessage?

    Apple has had some missteps lately in the creative world. The garbage can look-alike Mac Pro is selling so poorly that I don't know anyone who owns one. Adobe's Premiere Pro takeover of Final Cut market share is significant and seems to be accelerating. It is getting harder and harder to justify the IT costs of supporting a department of Macs in an otherwise Windows environment, just to get the graphics work done. (Yes, Macs need support. They are not magic.) Most artists are getting used to using Windows through Boot Camp, and Windows 10 is actually a really nice experience.

    You are right that it is fairly safe to assume a creative is working on a Mac these days, but devices like Surface Pro are very impressive, even to us creatives. iPad Pro, to me, looks like a Surface Pro without the ability to run any of the apps that I really want to run. Let's face it, Creative Cloud programs like Photoshop and After Effects are where the money is, not those silly ideation apps Adobe keeps trying to push.

    Most creatives work on a workstation with a Wacom tablet and multiple monitors for maximum productivity. Given the creative's standard equipment of a primary workstation, a secondary tablet/laptop, and a smartphone, I am guessing a lot of creatives would choose Surface Pro over iPad (Pro or otherwise) as their secondary device.
  • robinthakur - Thursday, October 1, 2015 - link

    Most proper creatives doing it as a job that I know still use Apple, mainly for historic reasons it has to be said (try getting creatives to change tooling!) and the fact that the Surface Pro 3 runs Photoshop avoids the question of how well it runs it. The pen accuracy and pressure sensitivity as well as the display scaling are significant issues which hobble the SP3 to some extent and mean that it can't be used as a dedicated tool. The pen is designed primarily for OneNote, after all.

    The great unknown is the software for the iPad Pro. If Appl ecan persuade Adobe to release versions of CC and Micrososft to release versions of Office which are compiled for it with pen compatibility, then I can see it doing very well as all the User interface problems of not having a precision input device or keyboard will be solved.
  • KoolAidMan1 - Wednesday, September 16, 2015 - link

    A Macbook Pro is a much better laptop than the Surface and an iPad is a much better tablet. The value of the Surface is that it combines both. If you want to combine both devices while introducing compromises then its a good option. There's certainly something to be said for having fewer things.
  • Sc0rp - Wednesday, September 30, 2015 - link

    The pencil supports palm protection dude.
  • Morawka - Wednesday, September 16, 2015 - link

    they'll lose imessage and facetime.. they dont care about safari, and everyone can agree that itunes is garbage. you seriously cited itunes as a reason to stay apple? Simplistic device are great and all, but it severely limits how you can improve them 5-10 years down the road without inherently making them more complex (therefore losing the simplicity)

    they are made of metal and are nice looking. the ui looks like a candy shop. they are successful because the iphone is successful. you think it will stay this way for much longer tho? It remains to be seen, but odds are not in their favor.

    apple is pushing everyone to apps, even website developers (by ad blocking). apple is a compartmentalized experience on each device. They created lots of devices that only do a few things (but do them well) and then hope you buy all of them so they make lots of money.

    meanwhile competitors with complex systems which allow you to do much more with fewer devices, but has steeper learning curve. do you want to pack 3-4 devices that each do a couple of things good, or 1-2 devices that can do everything.

    let the market decide over the next 10 years, but eventually people will wise up and spend less money and pack less gadgets
  • centhar - Thursday, September 17, 2015 - link

    Apple users are the Pakleds of the computer world. "We can make it go, no intelligence is required"

Log in

Don't have an account? Sign up now