externally_connectable 编辑
Experimental
This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Type | Object |
---|---|
Mandatory | No |
Example | "externally_connectable": { // List of extension IDs that extension wishes to communicate with // If "browser_action" is specified but "browser_action.ids" is not, // no extensions can communicate with this extension. // To match all extension IDs use "*". "ids": [ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "cccccccccccccccccccccccccccccccc" ], // Regular expression patterns specifying web pages // If "matches" is not specified, no web pages can communicate with // this extension "matches": [ "https://example1.com/*", "*://*.example2.com/*" ] } |
Externally connectable allows extension developer to control which other extensions and web pages can communicate with this extension via 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.
"ids" attribute
ids
enables communication between this extension and other installed extensions specified by extension identifiers. Use the pattern "*"
if you wish to communicate with all extensions.
"matches" attribute
matches
enables communication between this extension and the web pages. This is a list of regular expressions for page URLs that you wish to communicate with.
Note: If browser_action
is not specified, communication among extensions is still allowed as if browser_action
was {"ids": ["*"] }
, therefore if you specify browser_action.matches
don't forget to add ids
if you still want to communicate with other extensions.
Browser compatibility
BCD tables only load in the browser
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论