Learn about adding contextual menu items and toolbar items to a Safari App Extension with information property list keys.
Contextual menu items and toolbar items give you ways to add more menu options and entry points to your Safari App Extension. These items can only be defined and adjusted using information property list keys.
Context Menu Items
SFSafari key lets your app extension add items to the context menu shown in webpages. See Contextual Menus for design guidelines.
Its value must be an array, and must contain one dictionary with two subkeys for each menu item:
Required. A string that specifies the text to display for the context menu item.
Required. A string that the context menu item sends when activated. It contains the name of the command you want sent to your app extension when the user selects your item.
For example, if you were to add two contextual menu items, your
Infofile might look like the following:
SFSafari dictionary adds a toolbar item to Safari windows. See Toolbars for design guidelines.
Each app extension can have only one toolbar item. The value for this key is a dictionary that describes the toolbar item.
There are four required keys for the toolbar item dictionary:
Required. A string identifier for the toolbar item. This isn't displayed to the user.
Required. A string that's shown in the overflow menu, in the Customize palette, and on hover.
Required. A string specifying the filename of a scalable PDF image. The image must be transparent. Add the image file to your extension's Xcode target.
Required. A string specifying the command to send when the toolbar item is clicked. Available actions are
Here is an example dictionary, specified as XML:
Image key to provide an image for the toolbar button. The toolbar button image may be resized or recolored by Safari when drawn to the screen. Your image should be a template image and follow the guidelines for toolbar items.