docs/api/extensions.md
Electron supports a subset of the Chrome Extensions API, primarily to support DevTools extensions and Chromium-internal extensions, but it also happens to support some other extension capabilities.
[!NOTE] Electron does not support arbitrary Chrome extensions from the store, and it is a non-goal of the Electron project to be perfectly compatible with Chrome's implementation of Extensions.
Electron only supports loading unpacked extensions (i.e., .crx files do not
work). Extensions are installed per-session. To load an extension, call
ses.extensions.loadExtension:
const { session } = require('electron')
session.defaultSession.loadExtension('path/to/unpacked/extension').then(({ id }) => {
// ...
})
Loaded extensions will not be automatically remembered across exits; if you do
not call loadExtension when the app runs, the extension will not be loaded.
Note that loading extensions is only supported in persistent sessions. Attempting to load an extension into an in-memory session will throw an error.
See the session documentation for more information about
loading, unloading, and querying active extensions.
We support the following extensions APIs, with some caveats. Other APIs may additionally be supported, but support for any APIs not listed here is provisional and may be removed.
nameversionauthorpermissionscontent_scriptsdefault_localedevtools_pageshort_namehost_permissions (Manifest V3)manifest_versionbackground (Manifest V2)minimum_chrome_versionSee Manifest file format for more information about the purpose of each possible key.
chrome.devtools.inspectedWindowAll features of this API are supported.
See official documentation for more information.
chrome.devtools.networkAll features of this API are supported.
See official documentation for more information.
chrome.devtools.panelsAll features of this API are supported.
See official documentation for more information.
chrome.extensionThe following properties of chrome.extension are supported:
chrome.extension.lastErrorThe following methods of chrome.extension are supported:
chrome.extension.getURLchrome.extension.getBackgroundPageSee official documentation for more information.
chrome.managementThe following methods of chrome.management are supported:
chrome.management.getAllchrome.management.getchrome.management.getSelfchrome.management.getPermissionWarningsByIdchrome.management.getPermissionWarningsByManifestThe following events of chrome.management are supported:
chrome.management.onEnabledchrome.management.onDisabledSee official documentation for more information.
chrome.runtimeThe following properties of chrome.runtime are supported:
chrome.runtime.lastErrorchrome.runtime.idThe following methods of chrome.runtime are supported:
chrome.runtime.getBackgroundPagechrome.runtime.getManifestchrome.runtime.getPlatformInfochrome.runtime.getURLchrome.runtime.connectchrome.runtime.sendMessagechrome.runtime.reloadThe following events of chrome.runtime are supported:
chrome.runtime.onStartupchrome.runtime.onInstalledchrome.runtime.onSuspendchrome.runtime.onSuspendCanceledchrome.runtime.onConnectchrome.runtime.onMessageSee official documentation for more information.
chrome.scriptingAll features of this API are supported.
See official documentation for more information.
chrome.storageThe following methods of chrome.storage are supported:
chrome.storage.localchrome.storage.sync and chrome.storage.managed are not supported.
See official documentation for more information.
chrome.tabsThe following methods of chrome.tabs are supported:
chrome.tabs.sendMessagechrome.tabs.reloadchrome.tabs.executeScriptchrome.tabs.query (partial support)
url, title, audible, active, muted.chrome.tabs.update (partial support)
url, muted.[!NOTE] In Chrome, passing
-1as a tab ID signifies the "currently active tab". Since Electron has no such concept, passing-1as a tab ID is not supported and will raise an error.
See official documentation for more information.
chrome.webRequestAll features of this API are supported.
[!NOTE] Electron's
webRequestmodule takes precedence overchrome.webRequestif there are conflicting handlers.
See official documentation for more information.