Update To 11.40.268.0
[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#method-connect">runtime.connect</a> and <a href="../runtime#method-sendMessage">runtime.sendMessage</a>.
5 </p>
6
7 <p>
8 For a tutorial on message passing see <a href="../messaging#external">cross-extension and app messaging</a> and <a href="../messaging#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
23     // extensions or apps can connect.
24     "ids": [
25       "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
26       "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
27       ...
28       // Alternatively, to match all extensions and apps, specify only
29       // "*".
30       "*"
31     ],
32     // Match patterns for web pages. Does not affect content scripts.
33     // If this field is not specified, no webpages can connect.
34     "matches": [
35       "https://*.google.com/*",
36       "*://*.chromium.org/*",
37       ...
38     ],
39     // Indicates that the extension would like to make use of the TLS
40     // channel ID of the web page connecting to it. The web page must
41     // also opt to send the TLS channel ID to the extension via setting
42     // <code>includeTlsChannelId</code> to <code>true</code> in $(ref:runtime.connect)'s connectInfo
43     // or $(ref:runtime.sendMessage)'s options.
44     "accepts_tls_channel_id": false
45   },
46   ...
47 }
48 </pre>
49
50 <h2 id="reference">Reference</h2>
51 <p class="api_reference">
52 The externally_connectable manifest key can have the following properties:
53 {{+partials.manifest_type type:data/}}
54 </p>