externally_connectable
매니페스트 속성은 runtime.connect 및 runtime.sendMessage를 통해 확장 프로그램에 연결할 수 있는 확장 프로그램, 앱, 웹페이지를 선언합니다.
메시지 전달에 관한 튜토리얼은 교차 확장 프로그램 및 앱 메시지와 웹페이지에서 메시지 전송을 참고하세요.
External_connectable을 사용하지 않고 연결
확장 프로그램의 매니페스트에 externally_connectable
가 선언되지 않은 경우 모든 확장 프로그램과 앱을 연결할 수 있지만 웹페이지를 연결할 수는 없습니다. 따라서 externally_connectable
를 사용하도록 매니페스트를 업데이트할 때 "ids": ["*"]
을 지정하지 않으면 다른 확장 프로그램과 앱이 확장 프로그램에 연결할 수 없게 됩니다. 이는 의도치 않은 결과일 수 있으므로 유의하시기 바랍니다.
샘플 manifest.json
{
"name": "My externally connectable extension",
"externally_connectable": {
// Extension and app IDs. If this field is not specified, no
// extensions or apps can connect.
"ids": [
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
...
// Alternatively, to match all extensions and apps, specify only
// "*".
"*"
],
// Match patterns for web pages. Does not affect content scripts.
// If this field is not specified, no webpages can connect.
"matches": [
"https://*.google.com/*",
"*://*.chromium.org/*",
...
],
// Indicates that the extension would like to make use of the TLS
// channel ID of the web page connecting to it. The web page must
// also opt to send the TLS channel ID to the extension via setting
// includeTlsChannelId to true in runtime.connect's connectInfo
// or runtime.sendMessage's options.
"accepts_tls_channel_id": false
},
...
}
참조
external_connectable 매니페스트 키에는 다음 속성이 포함될 수 있습니다.
ids
(문자열 배열) - 선택사항연결이 허용된 확장 프로그램 또는 앱의 ID입니다. 비워 두거나 지정하지 않으면 확장 프로그램이나 앱을 연결할 수 없습니다.
"*"
와일드 카드를 사용하면 모든 확장 프로그램과 앱을 연결할 수 있습니다.matches
(문자열 배열) - 선택사항연결이 허용되는 웹페이지의 URL 패턴입니다. 이는 콘텐츠 스크립트에는 영향을 미치지 않습니다. 비워 두거나 지정하지 않으면 웹페이지를 연결할 수 없습니다.
패턴에는 (유효) 최상위 도메인의 와일드 카드 도메인이나 하위 도메인이 포함될 수 없습니다.
*://google.com/*
및http://*.chromium.org/*
는 유효하지만<all_urls>
,http://*/*
,*://*.com/*
,http://*.appspot.com/*
는 유효하지 않습니다.accepts_tls_channel_id
(불리언) - 선택사항true
인 경우 runtime.connect 또는 runtime.sendMessage를 통해 전송된 메시지는 runtime.MessageSender.tlsChannelId를 요청할 때 해당 메서드를 통해 설정합니다.false
인 경우 어떤 경우에도 runtime.MessageSender.tlsChannelId가 설정되지 않습니다.