Instances of the
Safari class represent a contextual menu that is populated by the extension. Safari displays the contents of this menu as part of its contextual menu.
- Safari Desktop 5.0+
- Safari Extensions JS
Each time a contextual menu is about to be displayed, Safari creates a new menu, populated with the default menu items from your extension’s
Info file. Next, a
Safari event is sent, and its listeners add menu items to the menu. Then a
Safari is sent for each menu item, and its listeners have the opportunity to prevent items in the context menu from being displayed by marking them as disabled.
Your extension has access only to context menu items that it has added; there is no way to change or count menu items from Safari or other extensions. Therefore, it is important to limit the menu items that your extension adds to a reasonable number, to avoid displaying an unusably long contextual menu.