Spec-Zone.ru › Web Extensions

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 runtime.connect() and 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.connect and chrome.runtime.sendMessage are 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.connect and browser.runtime.sendMessage are 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_connectable is not specified, communication among extensions is allowed as if externally_connectable specified {"ids": ["*"] }. Therefore, if you specify externally_connectable.matches, don't forget to add ids if you want to communicate with other extensions.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
externally_connectable Yes 79
NoSee bug 1319168.
? Yes
15.4Safari only supports the matches property.
? ? No ?
15.4Safari only supports the matches property.
?

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/externally_connectable

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API