What’s New in Safari 

Session 515 WWDC 2019

The latest version of Safari on macOS and iOS is packed with new capabilities that both web developers and their customers will love. Discover how to take advantage of new features including powerful new Safari Extensions APIs for window, tab, and popover management, content blocking notifications, and enhancements to make link following in your Mac apps and iPad Apps for Mac a great experience.

[ Music ]

[ Applause ]

Hello. My name is Jessie Berlin, and I’m here to talk about what’s new in Safari.

We have three topics to cover today, and the most exciting one is desktop-class browsing on iPad.

In iOS 13, we’ve made a set of fundamental changes to allow iPad to browse desktop websites, and you’ll notice here that I’m showing Safari View Controller.

It also gets these desktop websites right out of the box.

If you have a custom in-app web browser, or even just an app that uses WKWebView, you’re going to want to check out the talk from earlier this week for detailed guidance and best practices.

So if you haven’t already, go check it out.

Next up, improvements to Safari extensions.

We’ll start with a refresher on the four different types of Safari extensions.

First, there are Legacy Safari extensions from macOS.

They were introduced in 2010 with Mac OS X Snow Leopard, and deprecated last year.

Next, content blockers.

These are available for both iOS and macOS, and they’re designed for speed and user privacy.

Third, share extensions.

These are also available on both iOS and macOS.

Once invoked by the user, they’re able to run JavaScript on the webpage, and return data to your app extension.

And finally, Safari app extensions, available on macOS.

These run on web pages without user action and can be restricted to run on a single website or run everywhere.

Now that content blockers, share extensions, and Safari app extensions provide great extensibility options without the performance and privacy problems of Legacy Safari extensions, we are dropping support for Legacy Safari extensions in Safari 13.

Safari will no longer load them.

Today, we’re going to be primarily focusing on improvements to content blockers and Safari app extensions on macOS.

These Safari extensions come bundled with Mac apps built in Xcode, which gives you the ability to take advantage of powerful native APIs and frameworks, as well as HTML, JavaScript, and CSS.

And when you install an app with a Safari app extension from the Mac App Store, your extensions show up immediately in Safari’s preferences, ready for your users to turn on.

However, you can also distribute your app directly from your website after running it through the notarization service.

Notarized apps need to be launched at least once for their extension to show up in Safari.

We love the content blockers and Safari app extensions you have created, and we also really appreciate those of you who have filed bug reports, suggested improvements, and commented on the Safari developer forums.

And in response to that feedback, we’ve added new APIs for Safari app extensions to use.

Earlier this year, we built out our windows and tabs APIs.

Now you can navigate a tab directly from your app extension process to your full-page content, to provide extra functionality, like a dashboard.

You can get all the open windows and tabs to provide things like bookmarking services, and get a reference to the containing tab and window when handling a message from your injected script to do things like updating your toolbar items.

We’ve added a way for you to get the visible contents of a page.

You could use this, for example, to show a custom visual representation of your user’s tabs.

And you now have more control over your UI in Safari, with the ability to programmatically show and dismiss your pop-overs when it makes the most sense for your use cases.

You gave us feedback about wanting to know when a page will navigate, in order to redirect for a different version of the website.

New in Safari 13, there’s a callback that your app extension can handle to get notified of the full redirect chain.

For those of you who developed content blockers, we heard that you really want a way to show off to your users just how much you’re helping protect them against tracking, crypto currency mining, or other unnecessary scripts.

So we’re excited to announce, in Safari 13, that you can now associate your content blocker with your Safari app extension, so that it can get notified when content is blocked.

Users will be able to just turn on the Safari app extension if they want to get statistics from you on what you’ve blocked or keep it off if they want the most private experience.

I’ve gone through these APIs pretty quickly here, but we’ve created a video that you can watch to learn more in-depth how to adopt them.

Check it out in the WWDC app.

The last time you checked out Safari app extensions might’ve been in 2016, when we first introduced them.

As you can see from what we covered today, we’ve added a lot of functionality and APIs since then.

If you haven’t converted your Legacy Safari extension yet, head on over to our guide on developer.apple.com.

And that’s improvements to Safari extensions.

Lastly, I want to talk about following links on macOS.

I’m of course talking about following links like these to websites and apps.

For those of you bringing your iPad apps to the Mac, you might be wondering how this is going to work.

In-app web browsing isn’t common on macOS, but it is on iOS.

And on iOS, you’re probably using SafariViewController for the best in-app web browsing experience.

When you open a link in SafariViewController in your Mac app, it does exactly what your macOS users will expect.

It opens the link directly in their browser, and immediately calls SafariViewController did finish to notify you.

For those of you who have implemented custom in-app web browser on iOS, you should strongly instead consider directly opening links on Mac, so that they open in the user’s web browser.

That’s what your macOS users will be expecting.

We’re also excited that universal links are coming to macOS this year.

On iOS and macOS, universal links allow you to have ordinary HTTPS URLs to your website open in your app instead, if it’s installed.

It’s way better than custom URL schemes, which just don’t work if your app isn’t installed.

Universal links on Mac initially open in your web browser, just like before, and when they open in Safari and your app is installed, Safari will show a banner at the top of the webpage.

There, the user can choose to open the link in your app, and if they do, future link follows will be open directly in your app.

To learn more about universal links, check out the video we made, available right now in the WWDC app.

And that’s following links on macOS.

There have been a bunch of great improvements in the intersection of app development and web technologies this year.

One last point I want to leave you with.

We’re committed to making Safari app extensions and content blockers better each year.

If you had previously checked them out but found that a particular API or capability was missing, it’s worth taking another look and converting your Legacy Safari extension.

To find out more about what we covered today, check out the WWDC app, where there’ll be links to resources we talked about and further documentation.

And if you have any questions right now, we’ll be headed over to Technology Lab 3.

We’d love to see you there.

Thank you so much and have a great WWDC.

[ Applause ]

Apple, Inc. AAPL
1 Infinite Loop Cupertino CA 95014 US