Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/runtime/onstartup/index.md
6552 views
------{{AddonSidebar()}}
Fired when a profile that has this extension installed first starts up. This event is not fired when a private browsing/incognito profile is started, even if this extension is operating in 'split' incognito mode.
Syntax
Event Functions
All events have three functions:
addListener(listener): Adds a
listenerto the calling event.
removeListener(listener): Stop listening to the calling event. The
listenerargument is the listener to remove.
hasListener(listener): Checks whether a
listeneris registered for the calling event. Returnstrueif it is listening,falseotherwise.
Parameters
The only parameter is listener, used for any of the above functions.
listener: A function that will be called when this event occurs.
Browser compatibility
{{Compat}}
Examples
Open https://giphy.com/explore/cat when the browser starts up:
{{WebExtExamples}}
Note: This API is based on Chromium's
chrome.runtimeAPI. This documentation is derived fromruntime.jsonin the Chromium code.