Get the Lowest Prices anywhere on Macs, iPads and Apple Watches: Apple Price Guides updated December 10th
 

 
Feature

Safari 10 brings fast, native App Extensions to the macOS browser, web content

Building on work completed last year to enable Web Content Blockers, Apple's new Safari 10 enables a wide range of native code App Extensions that users can automatically obtain and update through the Mac App Store, contributing to faster performance, enhanced security and better reliability.


Safari 10 for macOS


A big update from the original Safari 5.0 Extensions



Back in 2010, Apple introduced a Safari Extensions Gallery for Safari 5.0, enabling developers to build extension plugins for Safari using web standards such as CSS and JavaScript.


Safari 5.0 Extensions Gallery


Safari 5.0 Extensions provided a way for third parties to add buttons to the Safari toolbar, make a new extension bar, change the way web content appeared or add controls to web pages. The architecture also supported digital signing so that developers could verify where a particular extension originated and prove that it hadn't been tampered with.

Apple helped third parties distribute their Safari Extensions in a Gallery which acted like a web-specific App Store for both perusing new extensions and obtaining updates. Building these extensions in web standards enabled them to work across platform; at the time Safari was being developed for both OS X and Windows.

However, a couple years later, Apple abandoned Windows support in 2012's Safari 6, effectively delegating the task of maintaining a WebKit browser to Google's Chrome and similar projects. That opened the door to the idea of building Safari Extensions using native Objective-C or Swift code for performance reasons.

In 2014, Apple introduced App Extensions, a new architecture for building app components that could be distributed with an app, and designed specifically to add insert new functionality into core OS features on both iOS and macOS.

Creating an App Extension requires Apple's support for creating an Extension Point in the OS that developers can build upon. The initial Extension Points Apple introduced in 2014 included system-wide Share Extensions (adding new social network sharing options), Photo Editing Extensions (extending the features of the Photos app), Today Extensions (supporting widgets) and Custom Keyboards specific to iOS.

The following year, Apple introduced Content Blockers as a new class of App Extensions specially targeting Safari, supporting the ability to prevent the downloading of any defined content, including display ads, images, navigation elements, popups, scripts, fonts, style sheets, media files, cookies, or essentially anything on a web page.

With Safari 10, any Extension can be a native App Extension



On both macOS Sierra 10.12 and today's El Capitan 10.11.5 (when Safari 10 is installed), Safari will support App Extensions built from a combination of JavaScript, CSS and native code written in Objective-C or Swift.Safari will support App Extensions built from a combination of JavaScript, CSS and native code written in Objective-C or Swift

Like previous App Extensions, the new architecture defines a broad Extension Point for Safari that allows third party developers to add new functionality to Safari, both to read and modify web page content (such as translating text into another language) and to communicate back and forth with a native app to integrate app data into Safari or to get web data into an app.

Developers can extend the Safari user interface by adding a toolbar button to execute a command or display a popover window, add a contextual menu item, inject a style sheet that alters how web pages are presented (such as modifying fonts used or text sizes), or inject JavaScript that changes how a page behaves or enables it to communicate with the app extension.

Unlike previous Safari Extensions, the new App Extensions can communicate securely with a developer's app using shared resources, as depicted in Apple's developer documentation (portrayed below).




More importantly, the new App Extensions architecture enables developers to distribute Safari Extensions as part of their app through the App Store. That means users won't have to go looking for a plugin from an independent "Gallery" on the web. For developers, moving their existing Safari Extensions to native App Extensions is designed to be easy to do in Xcode

The "Safari Extensions..." menu in macOS Sierra now launches the Mac App Store, which will present apps that include an App Extension for use in Safari. For developers, moving their existing Safari Extensions to native App Extensions is designed to be easy to do in Xcode.

This change also means that user App Extensions can be updated in parallel with the developer's app, preventing compatibility problems related to different component versions between an extension and an app. Because they can now be written in native code, Safari App Extensions can perform faster and use less memory than before.

Beyond App Extensions, Safari 10 will also support Apple Pay transactions on the web (below), iPad Split View of two websites at once, Picture in Picture display of embedded HTML5 videos on Macs (like iPad introduced last year), and automatic use of HTML5 videos from sites that would otherwise attempt to use Adobe Flash or Microsoft Silverlight.


Apple Pay on the web with Safari 10


Other new iOS 10 & macOS Sierra App Extensions



Overall, Apple's App Extension architecture provides a secure way for developers to extend OS-level features, while also expanding the usefulness of developers' work across the system.

There are a wide variety of other new App Extensions being introduced in iOS 10 and macOS Sierra, enabling third parties to similarly add new features to a variety of extension points including Siri, Messages, Maps, Notifications and Call Directory. AppleInsider will examine how these new extension points can enable developers to add new features to Apple's platforms.