runtime.onStartup
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
browser.runtime.onStartup.addListener(listener)
browser.runtime.onStartup.removeListener(listener)
browser.runtime.onStartup.hasListener(listener)
Event Functions
All events have three functions:
addListener(listener)
- Adds a
listener
to the calling event. removeListener(listener)
- Stop listening to the calling event. The
listener
argument is the listener to remove. hasListener(listener)
- Checks whether a
listener
is registered for the calling event. Returnstrue
if it is listening,false
otherwise.
Parameters
The only parameter is listener
, used for any of the above functions.
Browser compatibility
Report problems with this compatibility data on GitHubwebextensions-desktop | webextensions-mobile | |||||
---|---|---|---|---|---|---|
onStartup | ChromeFull support23 | EdgeFull support79 | FirefoxFull support52 | OperaFull support15 | SafariFull support14 | Firefox for AndroidFull support52 |
Legend
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Examples
Open https://giphy.com/explore/cat when the browser starts up:
function handleStartup() {
browser.tabs.create({
url: "https://giphy.com/explore/cat"
});
}
browser.runtime.onStartup.addListener(handleStartup);
Acknowledgements
This API is based on Chromium's chrome.runtime
API. This documentation is derived from runtime.json
in the Chromium code.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.