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 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


View All Comments

  • centhar - Thursday, September 17, 2015 - link

    It's called a "toy" because all that "power" it has is relegated the iPad to just being a consumption device. The OS is not developed enough to make it a serious creation tool. Reply
  • ws3 - Friday, September 18, 2015 - link

    "The OS is not developed enough to make it a serious creation tool."
    That is not true at all. There is no OS-dependent reason why an equivalent pretty much any desktop software could not run on a high end iPad like the iPad Pro. Desktop applications themselves do not rely on the user having full access to the file system. Of course user interaction would have to be redone to compensate for the lack of a mouse, but the power and OS services required to get the work done are there.
  • centhar - Friday, September 18, 2015 - link

    One issue here, the lack of a file system. It makes organization, copying, managing, importing and exporting of data impossible in iOS. Which is needed for apps to function for the user like their desktop bretheren. Reply
  • ws3 - Saturday, September 19, 2015 - link

    There is a file system, of course. But it is not exposed to the user.

    Apple's idea is that manual organization of the file system is an obsolete concept for most users. iOS apps allow you to import and export files without having direct file system access. Of course, due to the lack of direct file system access, the user has much less control over exactly how his files are organized, and must rely upon app-internal organization and cloud services to manage files.

    The claim being made by Apple haters is that full user access to the file system is absolutely necessary. The claim being made by Apple is that full user access to the file system is more complexity than most users need or are able to handle, and that in the long run it will be seen as no more necessary than the manual layout of data in main memory -- something that was seen as critically important in the early days of computing, but which now, of course, is completely irrelevant to everyone except people writing operating systems.

    It remains to be seen who is correct. I suspect Apple is, but we'll have to wait a while to find out.
  • osxandwindows - Sunday, September 20, 2015 - link

    How about file managers for iOS, I use them all the time Reply
  • Sc0rp - Wednesday, September 30, 2015 - link

    Why is it that people were creating stuff on primitive operating systems back in the 90's with far less power available than the iPad, yet for some reason you think that the iPad's os isn't developed enough and it can't be used for productivity. This is someone that used to use Mac OS7/8/9 back in the day and did a lot of producing on those systems, which were limited to cooperative multitasking. Reply
  • osxandwindows - Wednesday, September 16, 2015 - link

    Well I don't have to buy a new device every 3 years Reply
  • wylie102 - Monday, September 21, 2015 - link

    "The Apple people are stupid sheep who can't think for themselves, and I hate to break it to you, but Apple consumers are a very small market compared to the overall PC and tablet market."

    A sheep is someone who follows the crowd, yet you state in your next sentence that the crowd is overwhelmingly using windows.

    So which is it? You can't have it both ways.
  • robinthakur - Thursday, October 1, 2015 - link

    I use a MS Surface Pro 3 and own an iPad Air 2 and I think the gap has narrowed in terms of what the ipad can't do (especially with a keyboard like the optional surface pro 3 keyboard) now that MS Office Web Apps run on them which is 90% of what the majority of working people need it to do. Now, obviously the Surface can do far more as a full blown Windows machine, and the software for it generally exists already. I as a power user and developer enjoy having that much control of full Windows and I need it. However it also has the historic disadvantages of running full windows which made people stop using it i.e. overheating, updates, security problems etc and complexity. For the average user who has been using an iPad in meetings for the last 5 years, Surface as an option really wasn't good enough as it was underpowered, battery poor, too small and too expensive. They have now changed to work with iPad and are used to working around some of the limitations and adapting their workflows.

    The reality is that the majority of users can get by with an iPad running a modern iOS with the appropriate apps unless they are doing something specialised like Visio, Photoshop or Maya or whatever. Speaking to the influencers and people with the power in business to change this through my job, the general consensus is that while they do like the Surface 3, and can see why having mobile Windows devices operating with a Windows enterprise stack makes things like SharePoint, and other enterprise MS software a much easier proposition, the reality is that MS has also made all it's software far more iPad friendly because the frightening alternative was people moving away from using software that didn't work on the iPad completely. We have zero choice on making software compatible with iPad because that's what people are using, period, and this can't change overnight. Apple has not properly targeted the corporate market other than maiking the devices basically compatible with things like VPN, Active Sync etc. because they haven't had any competition, but it wouldn't surprise me if they started taking it a bit more seriously.

    I think MS don't help themselves by changing their minds and approach constantly on things like RT, Windows Apps and others. Businesses are only now starting to gain confidence that they are serious about the Surface program, and who is to say they won't decide to can it next year if the iPad Pro is a success and they want to focus on software and farm it out to Dell/Hp etc?

    So nobody doubts that the Surface Pro 3 is a more capable device because it just is, but is it an appropriate device in an App centric world where most enterprise software can be delivered through a thin, light, cool-running iPad with Mobile Safari as a tier 1 browser via Office 365?
  • lilmoe - Wednesday, September 16, 2015 - link

    "most Apple users would never dream of changing ecosystems"

    Opinions.... Most have no brand loyalty whatsoever, and will move to the newer "best thing" as claimed by their peers in a heartbeat.

    iPads are great consumption devices, even I was suckered into buying one because my dad wanted one (his friend told him it was the best....."rolling eyes"). They are successful in part because of the devices themselves (and the brand), but that's not the major reason why. The more important reason is the *lack* of proper/legitimate competition in the iPad's target market.

    Tablets running mobile OSs are NOT a necessity in peoples lives. They're more like a novelty some of us buy for "convenience", and are easily replaced by phablets for most consumers. Those who want one, and are willing to pay, will find the iPad very appealing for its performance, smoothness, and selection of media consumption and companion apps. It's a proven product in that respect, and those who're paying the premium don't want to deal with "other issues".

    Android has had lots of trouble getting its performance and framerate game together. Google, and it's utter failure to deliver is at fault. Samsung is NOT a software company, and no matter how good and feature rich their modifications to Android are, lots of people will still find them "clunky" because these modifications were never native to the OS. Google's recent versions of Android are too little, too late. While stock Android is now fast and smooth, it still doesn't stand a chance against Touchwiz in neither features nor usability. Let me say this straight for those who think Touchwix is bad; the absolute majority of consumers HATE stock Android with a passion (tech blogs and XDA are NOT the majority of consumers, not by a long shot). Let me say one more thing if that wasn't offensive enough for stock Android lovers: While I personally believe Android is the king of smartphones (for now), it is the very reason why the non-iPad tablet market is so bad, confusing, cheap, and has no future.

    Windows RT (now Windows 10 Mobile, without the desktop) was the absolute best mobile OS ever to be installed on an ARM powered tablet IMHO. But it had a mix of management, timing and media conception problems (and sabotage), resulting in the alienation of both users and devs.

    Microsoft are really late to the consumer game, so late it's painful. They shouldn't have settled for firing Sinofsky, and everyone else behind how Windows 8/RT was executed, they should make sure they never find a career in tech.

    The Surface Pro is very successful and popular because its intended audience know exactly how capable it is. These guys don't need extensive advertising.

    True, it's Android (or rather more accurately, Samsung) on smartphones that forced Apple to reconsider lots of their design decisions with their iPhones. But it's Windows that's forcing them to change the face of iOS on their iPads.

    There are 3 major markets for tablets:
    1) consumers (dominated by Apple)
    2) prosumers (spread among Apple and Microsoft, with some Android users here and there)
    3) professionals and content creators (dominated by Microsoft).

    Apple's latest updates to iOS and the iPad are primarily for maintaining the second type. Because the first type couldn't give a rat's behind how a productive a tablet is.

Log in

Don't have an account? Sign up now