- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / templates / articles / manifest / externally_connectable.html
1 <h1>externally_connectable</h1>
2
3 <p>
4 The <code>externally_connectable</code> manifest property declares which extensions, apps, and web pages can connect to your {{platform}} via <a href="../runtime.html#method-connect">runtime.connect</a> and <a href="../runtime.html#method-sendMessage">runtime.sendMessage</a>.
5 </p>
6
7 <p>
8 For a tutorial on message passing see <a href="../messaging.html#external">cross-extension and app messaging</a> and <a href="../messaging.html#external-webpage">sending messages from web pages</a>.
9 </p>
10
11 <h2 id="without-externally-connectable">Connecting without externally_connectable</h2>
12
13 <p>
14 If <code>externally_connectable</code> is not declared in your {{platform}}'s manifest, all extensions and apps can connect, but no webpages can connect. As a consequence, when updating your manifest to use <code>externally_connectable</code>, if <code>"ids": ["*"]</code> is not specified then other extensions and apps will lose the ability to connect to your {{platform}}. This may be an unintended consequence, so keep it in mind.
15 </p>
16
17 <h2 id="manifest">Sample manifest.json</h2>
18 <pre data-filename="manifest.json">
19 {
20   "name": "My externally connectable {{platform}}",
21   "externally_connectable": {
22     // Extension and app IDs. If this field is not specified, no extensions or
23     // apps can connect.
24     "ids": [
25       "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
26       "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
27       ...
28       // Alternatively, to match all extensions and apps, specify only "*".
29       "*"
30     ],
31     // Match patterns for web pages. Does not affect content scripts. If this
32     // field is not specified, no webpages can connect.
33     "matches": [
34       "https://*.google.com",
35       "*://*.chromium.org",
36       ...
37     ],
38     // Indicates that the extension would like to make use of the TLS channel
39     // ID of the web page connecting to it. The web page must also opt to send
40     // the TLS channel ID to the extension via setting
41     // <code>includeTlsChannelId</code> to <code>true</code> in
42     // $ref:runtime.connect's connectInfo or $ref:runtime.sendMessage's options.
43     "accepts_tls_channel_id": false
44   },
45   ...
46 }
47 </pre>
48
49 <h2 id="reference">Reference</h2>
50 <p class="api_reference">
51 {{+partials.type @:apis.manifestTypes.byName.ExternallyConnectable}}
52 </p>