Safari extensions have a global page, represented by the Safari
class. The global page is loaded once when the extension is loaded, but it is never displayed to the user. It can contain resources such as scripts, images, and HTML content.
SDK
- Safari Desktop 5.0+
Framework
- Safari Extensions JS
Declaration
interface SafariExtensionGlobalPage
Overview
The global page is a good place to run scripts that should be run only once for all of Safari and to store data that is displayed in multiple locations. For example, a stock ticker extension could use a script on its global page fetch and store the stock prices. This makes it easier to keep the user interface consistent by allowing the extension to maintain only one source data; this also uses less memory than making a copy of the data for each window.