externally_connectable
| Type | Object |
|---|---|
| Mandatory | No |
| Manifest version | 2 or higher |
| Example |
"externally_connectable": {
"ids": [
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"cccccccccccccccccccccccccccccccc"
],
"matches": [
"https://example1.com/*",
"*://*.example2.com/*"
]
}
|
Externally connectable controls which other extensions and web pages can communicate with an extension using {{WebExtAPIRef("runtime.connect","runtime.connect()")}} and {{WebExtAPIRef("runtime.sendMessage", "runtime.sendMessage()")}} message passing. If externally_connectable is not specified, all extensions can communicate with each other but not with web pages.
[!NOTE] For communication with web pages:
- In Chrome,
chrome.runtime.connectandchrome.runtime.sendMessageare used. These methods are only available when there is at least one extension listening for messages, see chrome.runtime will no longer be defined unconditionally in Chrome 106 for more details.- In Safari,
browser.runtime.connectandbrowser.runtime.sendMessageare used.- In Firefox, neither API is supported. See Firefox bug 1319168.
“ids” attribute
ids enables communication between this extension and other installed extensions specified by extension identifiers. Use the pattern "*" to communicate with all extensions.
“matches” attribute
matches is a list of regular expressions that enables communication between an extension and the web pages that match the expression.
[!NOTE] If
externally_connectableis not specified, communication among extensions is allowed as ifexternally_connectablespecified{"ids": ["*"] }. Therefore, if you specifyexternally_connectable.matches, don’t forget to addidsif you want to communicate with other extensions.
Browser compatibility
{{Compat}}