Safari app extensions
Learn how Safari app extensions extend the web-browsing experience in Safari by leveraging web technologies and native code.
Overview
A Safari app extension can add new functionality to Safari by reading and modifying webpage content. These capabilities 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 a native version of an app.
[Image]
Safari app extensions use a combination of JavaScript, CSS, and native code written in Objective-C or Swift. Because you build Safari app extensions on the standard app extension model, you get many native app benefits:
You bundle Safari app extensions inside your app and distribute them through the App Store. You can distribute a Safari app extension with a Mac app or a Mac Catalyst app.
Because you distribute your app and your Safari app extension together, you minimize the chances of installing mismatched versions.
Your Safari app extension can securely communicate with your app using shared resources.
To become familiar with app extension concepts, see App Extensions. If you’re interested in deploying an extension you build for Chrome, Firefox, or Edge in Safari, or creating an extension that works in Safari and other browsers, see Safari web extensions.
Topics
Essentials
Building a Safari app extensionConverting a legacy Safari extension to a Safari app extensionTroubleshooting your Safari app extension
Injected style sheets and scripts
Using injected style sheets and scriptsInjecting a script into a webpageInjecting CSS style sheets into a webpagePassing messages between Safari app extensions and injected scriptsSFSafariExtensionHandlerSFSafariExtensionManagerSFSafariExtensionStateSFSafariPagePropertiesSFSafariExtensionHandlingSFExtensionProfileKey