Safari App Extensions

Learn how Safari app extensions extend the web-browsing experience in Safari by leveraging web technologies and native code.


A Safari app extension can add new functionality to Safari by reading and modifying webpage content. These capabilites enhance the tools you use, the tasks you can accomplish, and the data you can access in your browser. A Safari app extension is uniquely useful because it can communicate with a native app. Sharing data between an app and Safari lets you integrate app content into Safari or send web data back to the app, enabling a unified experience for a web version and native version of an app.

Image showing Safari app extensions communicating between the containing app and the Safari browser.

Safari app extensions are available in macOS 10.12 and later, and in OS X 10.11.5 with Safari 10 installed.

Safari app extensions use a combination of JavaScript, CSS, and native code written in Objective-C or Swift. Because they’re built on the standard app extension model, you get many native app benefits:

  • Safari app extensions are bundled inside an app and distributed through the App Store.

  • Because your app and Safari app extension are distributed together, you minimize the chances of mismatched revisions being installed.

  • Your Safari app extension can securely communicate with your app using shared resources.

To become familiar with app extension concepts, see App Extension Programming Guide.


First Steps

Building a Safari App Extension

Add, build, and enable a Safari App Extension.

Converting a Legacy Safari Extension to a Safari App Extension

Convert a Legacy Safari Extension to a Safari App Extension, automatically with keys or manually.

Troubleshooting Your Safari App Extension

Debug your Safari App Extension with these techniques.

Injecting Scripts and Style Sheets

Add, control, and update settings for injected scripts and style sheets in a Safari app extension.

About Injected Style Sheets and Scripts

Learn how you can affect the appearance or behavior of a webpage by using injected style sheets and scripts.

Injecting a Script into a Webpage

Inject a script that you've written from a Safari App Extension into a webpage.

Injecting CSS Style Sheets into a Webpage

Add to or override styles by injecting CSS style sheets into webpages.

Passing Messages Between Safari App Extensions and Injected Scripts

Pass data back and forth between Safari App Extension and injected scripts.

class SFSafariExtensionHandler

A base class that you subclass to handle events in your Safari app extension.

class SFSafariExtensionManager

A class used by your app to find out the current state of a Safari app extension.

class SFSafariExtensionState

The state of a Safari app extension.

class SFSafariPageProperties

Information about a webpage.

protocol SFSafariExtensionHandling

A protocol used to implement event handling in a Safari app extension.

Configuring and Customizing Safari App Extensions

Safari App Extension Info Property List Keys

Specify keys in your info property list file that provide information about your Safari App Extension, UI, and permissions to the operating system.

See Also

Safari App Extensions

class SFSafariExtension

A proxy for the Safari extension.

class SFSafariApplication

A proxy for the Safari app.

class SFSafariWindow

A proxy for a Safari window.

class SFSafariPage

A proxy for a Safari webpage.

class SFSafariTab

A proxy for a tab in a Safari window.