Safari

Apple is pushing Safari forward in iOS 11 with a number of advancements big and small.23 This year, the company has focused on rethinking the integration of Safari with apps and equipping users with tools to make the web more readable and private. Developer enhancements are in the spotlight as cosmetic tweaks and extensions wait on the sidelines.

Safari View Controller

Changes to iOS’ in-app web view technology feel like an uncharacteristic reversal of policy, but they’re simply the result of gathering feedback from developers and making an API that works better for everyone.

From a visual standpoint, Safari View Controller now looks more like a custom in-app web browser than an instance of Safari living inside an app. Technically, Safari View Controller still is the Safari engine and features made available to apps, but iOS 11 gives developers deeper control to customize its appearance and behavior.

Some users were probably confused by Safari View Controller looking exactly like Safari as they thought they had accidentally left an app and launched the browser. Thus to better embed Safari View Controller in apps, iOS 11 lets developers customize it with a different color and alternative labels for the Done button in the top left. Developers can use Cancel and Close for the button if that nomenclature fits their apps better. The effect of a fully-tinted Safari View Controller is nice: it’s still Safari, but it blends with the app you’re using so it doesn’t feel like you’re loading an external view.

The other big change is Safari’s uncoupling of cookies and website data from Safari View Controller.

Since iOS 9, the Safari View Controller API offered a single “truth” in terms of Safari data – whatever had been set in the Safari app carried over to Safari web views. With iOS 11, cookies, local storage, and other website data are scoped to individual instances of Safari View Controller. On one hand, this might result in a more tedious login process in apps because you have to pick an existing account from iCloud Keychain every time a login page is loaded in Safari View Controller; on the other, it removes any perplexity as to which cookies are shared between Safari and apps – the answer is none.

No longer tying Safari View Controller to Safari data allows for easier switching between “work” and “personal” accounts, and it also helps prevent cross-app tracking. I think Apple is making the right move here.24

Nevertheless, Apple knows that thousands of apps implement login sessions through Safari View Controller because they want to give users an easy way to authorize a service with a website they’re already logged into. To fulfill those requirements, there’s a new API in iOS 11 (called SFAuthenticationSession) that opens a special-purpose Safari View Controller blessed with a couple of exceptions from regular Safari views.

This version of Safari View Controller looks like the normal one, but it’s been designed for apps that require authentication with web services. When implemented in login flows, this flavor of Safari View Controller can communicate with a host app for completion and callback URLs (a technique used by popular services’ OAuth logins) and it uses the same cookies for a particular domain stored in the Safari app. Because of these differences, SFAuthenticationSession has to display a dialog when it’s invoked, asking you for permission to use a web domain to sign in.

SFAuthenticationSession will be used in a future version of Overcast to connect with your Twitter account.

Given the removal of social accounts and the technical changes to Safari View Controller in iOS 11, Apple had to find a compromise for apps that benefit from a shared Safari and Safari View Controller environment. Expect to see this variation of Safari View Controller become the default login solution for many of your favorite apps.

There are two more tweaks in iOS 11’s Safari View Controller. Apps can disable the standard bar collapsing behavior when scrolling in a Safari view; toolbars won’t squish as the page scrolls, which could also help apps that display login pages as the full domain and Cancel button stay fixed in the top toolbar.

Finally, because shopping websites often use window.open() to open new windows at checkout on desktop computers, Apple has found a way to preserve that JavaScript call in Safari View Controller (the “window” stays the same, and you navigate back and forth). I guess even Apple realized some old e-commerce websites are never going to be updated for mobile browsers at this point.

The idea of Safari View Controller in iOS 11 is that it should serve developers better and not be confusing to users. iOS 9’s Safari View Controller might have shown a certain pride in bringing Safari to every app, but the new model should scale better for apps and retain all the strengths of the original API.

Automatic Reader View

Safari’s built-in Reader mode has long aided in making sense of websites that litter their content with popups and interruptions. Safari Reader is an attractive escape hatch and a fantastic accessibility feature. With iOS 11, Apple wants to help make Reader your favorite way to browse and read articles on the web.

If you long-tap on the Reader icon in the Safari (or Safari View Controller) address bar, you’ll now see two options: always use Reader for all websites, or always use it for the current domain only. Essentially, the thinking is:

“The entire web looks terrible these days; I want to use Safari Reader all the time”; or

“This particular website is illegible; I should use Safari Reader when I open it every time”.

No matter the version of persistent Reader you choose, the setting will apply to both Safari and Safari View Controller. Just like before, the original webpage will load (giving publishers a page view), then Reader will be switched on immediately.

iOS 11’s automatic Safari Reader view continues Apple’s unsung war against webpages filled with extraneous content that are disrespectful of our time and attention. I’ve enabled it for a few websites that I read on a daily basis.

Extras

Alongside Safari View Controller and Reader, there are a variety of other refinements to iOS 11’s Safari.

Better sharing for AMP pages. When you share an AMP webpage with the iMessage and Mail extensions, or if you add the page to Reading List, iOS 11’s Safari automatically cleans up the URL to return the regular, non-AMP version.

AMP URLs are automatically “cleaned” by iOS 11 when sharing them.

Considering the criticism that AMP has caught for the way it obfuscates publishers’ article links, it’s great to see Apple taking steps to improve the experience for users.

Intelligent tracker blocking. Safari for iOS 11 features an on-device classifier to learn, identify, and automatically block privacy-intruding web trackers. The classifier is updated over time using machine learning, and it’s capable of whitelisting domains that shouldn’t be blocked if the user manually interacts with them. This feature is controlled by new Privacy & Security options in Safari ⇾ Settings ⇾ Prevent Cross-Site Tracking.

Tabs. The iPhone’s tab carousel view now lets you switch tabs by pressing on one with 3D Touch. You can also search tabs on the iPhone by revealing a search bar at the top of the list.

On both the iPad and iPhone, you can tap a link in a webpage with two fingers to immediately open it in a new tab. This is a faster gesture than long-pressing to open the link’s contextual menu, and it respects your preference for opening tabs in the foreground or background.

Another handy tweak: when a webpage opens a link in a new tab on the iPhone, you can go back with a swipe from the left edge of the screen; the new tab will close without having to open the browser’s tab view.

Home screen web apps. Web apps saved to the iOS Home screen now support all the features of modern WebKit: fast-tap, visual viewport, and scroll snapping. If you bookmark web apps this way, they should no longer feel like last-generation web wrappers.

Reading List. There’s a new toggle in Settings ⇾ Safari to automatically save Reading List articles offline. If an item is not saved offline, you can swipe on it for a Download option.

Content Blockers. The most controversial iOS 9 feature hasn’t received major upgrades in iOS 11, but developers of blocker extensions have more control with if-top-url and unless-top-url triggers. These match the whole URL instead of the host alone, giving Content Blockers more flexibility to identify specific URLs.

Bookmarks. Bookmarks in folders are now displayed in the expanded address bar as a grid of icons rather than a plain list of webpage titles.

WebRTC and Media Capture. Among several technical changes to WebKit, the adoption of WebRTC means iOS Safari can support modern rich web apps such as Cast and Zencastr, which allow end-to-end podcast recording in a web browser.

There's also support for the Media Capture API, which lets websites access the camera and microphone streams from a user's device (following a permission dialog). When Safari is recording audio, you’ll see a red microphone icon in the address bar.

Free of the controversy surrounding Content Blockers, Apple has improved various aspects of Safari and modernized its foundation with a focus on privacy and making the web a better place for users. The effects of Safari’s tracking prevention are still unproven, but Apple’s intentions are laudable. After Notes, Safari is the other crown jewel of Apple’s iOS app suite, and it keeps leading the way for the web industry at large.

Perhaps the smallest change: Safari's scrolling now has the same inertia as the rest of iOS. This felt different in June, but it's completely normal to me now. Out of curiosity, I tried Safari for iOS 10 again, and its non-inertial scrolling felt broken. ↩︎

This also means that if you keep Private Mode enabled in Safari, it won’t carry over to Safari View Controller in apps. ↩︎