OLD | NEW |
(Empty) | |
| 1 <h1 class="page_title">Formats: Manifest Files</h1> |
| 2 <p> |
| 3 Every extension, installable web app, and theme has a |
| 4 <a href="http://www.json.org">JSON</a>-formatted manifest file, |
| 5 named <code>manifest.json</code>, |
| 6 that provides important information. |
| 7 </p> |
| 8 <h2 id="overview"> Field summary </h2> |
| 9 <p> |
| 10 The following code shows the supported manifest fields, |
| 11 with links to the page that discusses each field. |
| 12 The only fields that are always required |
| 13 are <b>name</b> and <b>version</b>. |
| 14 </p> |
| 15 <pre> |
| 16 { |
| 17 <em>// Required</em> |
| 18 "<a href="#name">name</a>": "<em>My Extension</em>", |
| 19 "<a href="#version">version</a>": "<em>versionString</em>", |
| 20 "<a href="#manifest_version">manifest_version</a>": 2, |
| 21 <em>// Recommended</em> |
| 22 "<a href="#description">description</a>": "<em>A plain text description</em>", |
| 23 "<a href="#icons">icons</a>": { ... }, |
| 24 "<a href="#default_locale">default_locale</a>": "<em>en</em>", |
| 25 <em>// Pick one (or none)</em> |
| 26 "<a href="browserAction.html">browser_action</a>": {...}, |
| 27 "<a href="pageAction.html">page_action</a>": {...}, |
| 28 "<a href="themes.html">theme</a>": {...}, |
| 29 "<a href="#app">app</a>": {...}, |
| 30 <em>// Add any of these that you need</em> |
| 31 "<a href="background_pages.html">background</a>": {...}, |
| 32 "<a href="override.html">chrome_url_overrides</a>": {...}, |
| 33 "<a href="content_scripts.html">content_scripts</a>": [...], |
| 34 "<a href="../extensions/contentSecurityPolicy.html">content_security_policy</a
>": "<em>policyString</em>", |
| 35 "<a href="fileBrowserHandler.html">file_browser_handlers</a>": [...], |
| 36 "<a href="#homepage_url">homepage_url</a>": "http://<em>path/to/homepage</em>"
, |
| 37 "<a href="#incognito">incognito</a>": "spanning" <em>or</em> "split", |
| 38 "<a href="#intents">intents</a>": {...} |
| 39 "<a href="#key">key</a>": "<em>publicKey</em>", |
| 40 "<a href="#minimum_chrome_version">minimum_chrome_version</a>": "<em>versionSt
ring</em>", |
| 41 "<a href="#nacl_modules">nacl_modules</a>": [...], |
| 42 "<a href="#offline_enabled">offline_enabled</a>": true, |
| 43 "<a href="omnibox.html">omnibox</a>": { "keyword": "<em>aString</em>" }, |
| 44 "<a href="options.html">options_page</a>": "<em>aFile</em>.html", |
| 45 "<a href="#permissions">permissions</a>": [...], |
| 46 "<a href="npapi.html">plugins</a>": [...], |
| 47 "<a href="#requirements">requirements</a>": {...}, |
| 48 "<a href="autoupdate.html">update_url</a>": "http://<em>path/to/updateInfo</em
>.xml", |
| 49 "<a href="#web_accessible_resources">web_accessible_resources</a>": [...], |
| 50 "<a href="#sandbox">sandbox</a>": [...] |
| 51 } |
| 52 </pre> |
| 53 <h2>Field details</h2> |
| 54 <p> |
| 55 This section covers fields that aren't described in another page. |
| 56 For a complete list of fields, |
| 57 with links to where they're described in detail, |
| 58 see the <a href="#overview">Field summary</a>. |
| 59 </p> |
| 60 <h3 id="app">app</h3> |
| 61 <p> |
| 62 Used by installable web apps, |
| 63 including packaged apps, |
| 64 to specify the URLs that the app uses. |
| 65 Most important is the <em>launch page</em> for the app—the |
| 66 page that the browser goes to when the user clicks the app's icon |
| 67 in the New Tab page. |
| 68 </p> |
| 69 <p> |
| 70 For details, see the documentation for |
| 71 <a href="http://code.google.com/chrome/apps/docs/developers_guide.html">hosted a
pps</a> and |
| 72 <a href="apps.html">packaged apps</a>. |
| 73 </p> |
| 74 <h3 id="default_locale">default_locale</h3> |
| 75 <p> |
| 76 Specifies the subdirectory of <code>_locales</code> |
| 77 that contains the default strings for this extension. |
| 78 This field is <b>required</b> in extensions |
| 79 that have a <code>_locales</code> directory; |
| 80 it <b>must be absent</b> in extensions |
| 81 that have no <code>_locales</code> directory. |
| 82 For details, see |
| 83 <a href="i18n.html">Internationalization</a>. |
| 84 </p> |
| 85 <h3 id="description">description</h3> |
| 86 <p> |
| 87 A plain text string |
| 88 (no HTML or other formatting; |
| 89 no more than 132 characters) |
| 90 that describes the extension. |
| 91 The description should be suitable for both |
| 92 the browser's extension management UI |
| 93 and the <a href="https://chrome.google.com/webstore">Chrome Web Store</a>. |
| 94 You can specify locale-specific strings for this field; |
| 95 see <a href="i18n.html">Internationalization</a> for details. |
| 96 </p> |
| 97 <h3 id="homepage_url">homepage_url</h3> |
| 98 <p> |
| 99 The URL of the homepage for this extension. The extensions management page (chro
me://extensions) |
| 100 will contain a link to this URL. This field is particularly useful if you |
| 101 <a href="hosting.html">host the extension on your own site</a>. If you distribut
e your |
| 102 extension using the <a href="https://chrome.google.com/webstore">Chrome Web Stor
e</a>, |
| 103 the homepage URL defaults to the extension's own page. |
| 104 </p> |
| 105 <h3 id="icons">icons</h3> |
| 106 <p> |
| 107 One or more icons that represent the extension, app, or theme. |
| 108 You should always provide a 128x128 icon; |
| 109 it's used during installation and by the Chrome Web Store. |
| 110 Extensions should also provide a 48x48 icon, |
| 111 which is used in the extensions management page |
| 112 (chrome://extensions). |
| 113 You can also specify a 16x16 icon to be used as the favicon |
| 114 for an extension's pages. |
| 115 The 16x16 icon is also displayed in the experimental extension |
| 116 <a href="experimental.infobars.html">infobar</a> |
| 117 feature. |
| 118 </p> |
| 119 <p> |
| 120 Icons should generally be in PNG format, |
| 121 because PNG has the best support for transparency. |
| 122 They can, however, be in any format supported by WebKit, |
| 123 including BMP, GIF, ICO, and JPEG. |
| 124 Here's an example of specifying the icons: |
| 125 </p> |
| 126 <pre> |
| 127 "icons": { "16": "icon16.png", |
| 128 "48": "icon48.png", |
| 129 "128": "icon128.png" }, |
| 130 </pre> |
| 131 <p class="note"> |
| 132 <b>Important:</b> |
| 133 Use only the documented icon sizes. |
| 134 <br><br> |
| 135 You might notice that Chrome sometimes resizes these icons down to smaller |
| 136 sizes. For example, the install dialog might shrink the 128-pixel |
| 137 icon down to 69 pixels. |
| 138 <br><br> |
| 139 However, the details of |
| 140 Chrome's UI may change between versions, and these changes assume that |
| 141 developers are using the documented sizes. If you use other sizes, |
| 142 your icon may look bad in future versions of the browser. |
| 143 </p> |
| 144 <p> |
| 145 If you upload your extension, app, or theme using the |
| 146 <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Develope
r Dashboard</a>, |
| 147 you'll need to upload additional images, |
| 148 including at least one screenshot of your extension. |
| 149 For more information, |
| 150 see the |
| 151 <a href="http://code.google.com/chrome/webstore/">Chrome Web Store |
| 152 developer documentation</a>. |
| 153 </p> |
| 154 <h3 id="incognito">incognito</h3> |
| 155 <p> |
| 156 Either "spanning" or "split", to specify how this extension will |
| 157 behave if allowed to run in incognito mode. |
| 158 </p> |
| 159 <p> |
| 160 The default for extensions is "spanning", which means that the extension |
| 161 will run in a single shared process. Any events or messages from an incognito |
| 162 tab will be sent to the shared process, with an <em>incognito</em> flag |
| 163 indicating where it came from. Because incognito tabs cannot use this shared |
| 164 process, an extension using the "spanning" incognito mode will not be able to |
| 165 load pages from its extension package into the main frame of an incognito tab. |
| 166 </p> |
| 167 <p> |
| 168 The default for installable web apps is "split", |
| 169 which means that all app pages in |
| 170 an incognito window will run in their own incognito process. If the app or exten
sion contains a background page, that will also run in the incognito process. |
| 171 This incognito process runs along side the regular process, but has a separate |
| 172 memory-only cookie store. Each process sees events and messages only from its |
| 173 own context (for example, the incognito process will see only incognito tab upda
tes). |
| 174 The processes are unable to communicate with each other. |
| 175 </p> |
| 176 <p> |
| 177 As a rule of thumb, if your extension or app needs to load a tab in an incognito
browser, use |
| 178 <em>split</em> incognito behavior. If your extension or app needs to be logged |
| 179 into a remote server or persist settings locally, use <em>spanning</em> |
| 180 incognito behavior. |
| 181 </p> |
| 182 <h3 id="intents">intents</h3> |
| 183 <p> |
| 184 A dictionary that specifies all intent handlers provided by this extension or ap
p. Each key in the dictionary specifies an action verb that is handled by this e
xtension. The following example specifies two handlers for the action verb "<a h
ref="http://webintents.org/share">http://webintents.org/share</a>". |
| 185 </p> |
| 186 <pre> |
| 187 { |
| 188 "name": "test", |
| 189 "version": "1", |
| 190 "intents": { |
| 191 "http://webintents.org/share": [ |
| 192 { |
| 193 "type": ["text/uri-list"], |
| 194 "href": "/services/sharelink.html", |
| 195 "title" : "Sample Link Sharing Intent", |
| 196 "disposition" : "inline" |
| 197 }, |
| 198 { |
| 199 "type": ["image/*"], |
| 200 "href": "/services/shareimage.html", |
| 201 "title" : "Sample Image Sharing Intent", |
| 202 "disposition" : "window" |
| 203 } |
| 204 ] |
| 205 } |
| 206 } |
| 207 </pre> |
| 208 <p> |
| 209 The value of "type" is an array of mime types that is supported by this handler.
The "href" indicates the URL of the page that handles the intent. For hosted ap
ps, these URLs must be within the allowed set of URLs. For extensions, all URLs
are inside the extension and considered relative to the extension root URL. |
| 210 </p> |
| 211 <p> |
| 212 The "title" is displayed in the intent picker UI when the user initiates the act
ion specific to the handler. |
| 213 </p> |
| 214 <p> |
| 215 The "disposition" is either "inline" or "window". Intents with "window" disposit
ion will open a new tab when invoked. Intents with "inline" disposition will be
displayed inside the intent picker when invoked. |
| 216 </p> |
| 217 <p> |
| 218 For more information on intents, refer to the <a href="http://dvcs.w3.org/hg/web
-intents/raw-file/tip/spec/Overview.html">Web Intents specification</a> and <a h
ref="http://www.webintents.org">webintents.org</a>. |
| 219 </p> |
| 220 <h4>Handling content types via intents</h4> |
| 221 <p> |
| 222 Web Intents can be registered as content type viewers. To do that, the action ve
rb must be <a href="http://webintents.org/view">"http://webintents.org/view"</a>
, and the content type must be a white-listed MIME type. |
| 223 </p> |
| 224 <table> |
| 225 <tr> |
| 226 <th>Whitelisted MIME types</th> |
| 227 </tr> |
| 228 <tr><td>application/rss+xml</td></tr> |
| 229 <tr><td>application/atom+xml</td></tr> |
| 230 </table> |
| 231 <h3 id="key">key</h3> |
| 232 <p> |
| 233 This value can be used to control |
| 234 the unique ID of an extension, app, or theme when |
| 235 it is loaded during development. |
| 236 </p> |
| 237 <p class="note"> |
| 238 <b>Note:</b> You don't usually need to |
| 239 use this value. Instead, write your |
| 240 code so that the key value doesn't matter |
| 241 by using <a href="overview.html#relative-urls">relative paths</a> |
| 242 and <a href="extension.html#method-getURL">chrome.extension.getURL()</a>. |
| 243 </p> |
| 244 <p> |
| 245 To get a suitable key value, first |
| 246 install your extension from a <code>.crx</code> file |
| 247 (you may need to |
| 248 <a href="https://chrome.google.com/webstore/developer/dashboard">upload your ext
ension</a> |
| 249 or <a href="packaging.html">package it manually</a>). |
| 250 Then, in your |
| 251 <a href="http://www.chromium.org/user-experience/user-data-directory">user |
| 252 data directory</a>, look in the file |
| 253 <code>Default/Extensions/<em><extensionId></em>/<em><versionString><
/em>/manifest.json</code>. |
| 254 You will see the key value filled in there. |
| 255 </p> |
| 256 <h3 id="minimum_chrome_version">minimum_chrome_version</h3> |
| 257 <p> |
| 258 The version of Chrome that your extension, app, or theme requires, if any. |
| 259 The format for this string is the same as for the |
| 260 <a href="#version">version</a> field. |
| 261 <h3 id="name">name</h3> |
| 262 <p> |
| 263 A short, plain text string |
| 264 (no more than 45 characters) |
| 265 that identifies the extension. |
| 266 The name is used in the install dialog, |
| 267 extension management UI, |
| 268 and the <a href="https://chrome.google.com/webstore">store</a>. |
| 269 You can specify locale-specific strings for this field; |
| 270 see <a href="i18n.html">Internationalization</a> for details. |
| 271 </p> |
| 272 <h3 id="nacl_modules">nacl_modules</h3> |
| 273 <p> |
| 274 One or more mappings from MIME types to the Native Client module |
| 275 that handles each type. |
| 276 For example, the bold code in the following snippet |
| 277 registers a Native Client module as the content handler |
| 278 for the OpenOffice spreadsheet MIME type. |
| 279 </p> |
| 280 <pre> |
| 281 { |
| 282 "name": "Native Client OpenOffice Spreadsheet Viewer", |
| 283 "version": "0.1", |
| 284 "description": "Open OpenOffice spreadsheets, right in your browser.", |
| 285 <b>"nacl_modules": [{ |
| 286 "path": "OpenOfficeViewer.nmf", |
| 287 "mime_type": "application/vnd.oasis.opendocument.spreadsheet" |
| 288 }]</b> |
| 289 } |
| 290 </pre> |
| 291 <p> |
| 292 The value of "path" is the location of a Native Client manifest |
| 293 (a <code>.nmf</code> file) |
| 294 within the extension directory. |
| 295 For more information on Native Client and <code>.nmf</code> files, see the |
| 296 <a href="http://code.google.com/chrome/nativeclient/docs/technical_overview.html
">Native Client Technical Overview</a>. |
| 297 </p> |
| 298 <p> |
| 299 Each MIME type can be associated with only one <code>.nmf</code> file, |
| 300 but a single <code>.nmf</code> file might handle multiple MIME types. |
| 301 The following example shows an extension |
| 302 with two <code>.nmf</code> files |
| 303 that handle three MIME types. |
| 304 </p> |
| 305 <pre> |
| 306 { |
| 307 "name": "Spreadsheet Viewer", |
| 308 "version": "0.1", |
| 309 "description": "Open OpenOffice and Excel spreadsheets, right in your browser.
", |
| 310 "nacl_modules": [{ |
| 311 "path": "OpenOfficeViewer.nmf", |
| 312 "mime_type": "application/vnd.oasis.opendocument.spreadsheet" |
| 313 }, |
| 314 { |
| 315 "path": "OpenOfficeViewer.nmf", |
| 316 "mime_type": "application/vnd.oasis.opendocument.spreadsheet-template" |
| 317 }, |
| 318 { |
| 319 "path": "ExcelViewer.nmf", |
| 320 "mime_type": "application/excel" |
| 321 }] |
| 322 } |
| 323 </pre> |
| 324 <p class="note"> |
| 325 <strong>Note:</strong> |
| 326 You can use Native Client modules in extensions |
| 327 without specifying "nacl_modules". |
| 328 Use "nacl_modules" only if you want the browser |
| 329 to use your Native Client module |
| 330 to display a particular type of content. |
| 331 </p> |
| 332 <h3 id="offline_enabled">offline_enabled</h3> |
| 333 <p> |
| 334 Whether the app or extension is expected to work offline. When Chrome detects |
| 335 that it is offline, apps with this field set to true will be highlighted |
| 336 on the New Tab page. |
| 337 </p> |
| 338 <h3 id="permissions">permissions</h3> |
| 339 <p> |
| 340 An array of permissions that the extension or app might use. |
| 341 Each permission can be either one of a list of known strings |
| 342 (such as "geolocation") |
| 343 or a match pattern |
| 344 that gives access to one or more hosts. |
| 345 Permissions can help to limit damage |
| 346 if your extension or app is attacked. |
| 347 Some permissions are also displayed to users before installation, |
| 348 as detailed in |
| 349 <a href="permission_warnings.html">Permission Warnings</a>. |
| 350 </p> |
| 351 <p> |
| 352 If an extension API requires you to declare a permission in the manifest, |
| 353 then its documentation tells you how to do so. |
| 354 For example, |
| 355 the <a href="tabs.html">Tabs</a> page |
| 356 shows you how to |
| 357 declare the "tabs" permission. |
| 358 </p> |
| 359 <p class="note"> |
| 360 <b>Note:</b> |
| 361 As of Chrome 16, some permissions can be optional. |
| 362 For details, see |
| 363 <a href="permissions.html">Optional Permissions</a>. |
| 364 </p> |
| 365 <p> |
| 366 Here's an example of the permissions part of a manifest file |
| 367 for an extension: |
| 368 </p> |
| 369 <pre> |
| 370 "permissions": [ |
| 371 "tabs", |
| 372 "bookmarks", |
| 373 "http://www.blogger.com/", |
| 374 "http://*.google.com/", |
| 375 "unlimitedStorage" |
| 376 ], |
| 377 </pre> |
| 378 <p> |
| 379 The following table lists the permissions an extension |
| 380 or packaged app can use. |
| 381 </p> |
| 382 <p class="note"> |
| 383 <strong>Note:</strong> |
| 384 Hosted apps can use the |
| 385 "background", "clipboardRead", "clipboardWrite", "geolocation", "notifications", |
| 386 and "unlimitedStorage" permissions, but not any other permissions listed in this |
| 387 table. |
| 388 </p> |
| 389 <table> |
| 390 <tr> |
| 391 <th> Permission </th> <th> Description </th> |
| 392 </tr> |
| 393 <tr> |
| 394 <td> <em>match pattern</em> </td> |
| 395 <td> Specifies a <em>host permission</em>. |
| 396 Required if the extension wants to interact |
| 397 with the code running on pages. |
| 398 Many extension capabilities, such as |
| 399 <a href="xhr.html">cross-origin XMLHttpRequests</a>, |
| 400 <a href="content_scripts.html#pi">programmatically injected |
| 401 content scripts</a>, and <a href="cookies.html">the cookies API</a> |
| 402 require host permissions. For details on the syntax, see |
| 403 <a href="match_patterns.html">Match Patterns</a>. |
| 404 </td> |
| 405 </tr> |
| 406 <tr id="bg"> |
| 407 <td> "background" </td> |
| 408 <td> <p> |
| 409 Makes Chrome start up early and and shut down late, |
| 410 so that apps and extensions can have a longer life. |
| 411 </p> |
| 412 <p> |
| 413 When any installed hosted app, packaged app, or extension |
| 414 has "background" permission, Chrome runs (invisibly) |
| 415 as soon as the user logs into their computer—before |
| 416 the user launches Chrome. |
| 417 The "background" permission also makes Chrome continue running |
| 418 (even after its last window is closed) |
| 419 until the user explicitly quits Chrome. |
| 420 </p> |
| 421 <p class="note"> |
| 422 <b>Note:</b> |
| 423 Disabled apps and extensions |
| 424 are treated as if they aren't installed. |
| 425 </p> |
| 426 <p> |
| 427 You typically use the "background" permission with a |
| 428 <a href="background_pages.html">background page</a> |
| 429 or (for hosted apps) a |
| 430 <a href="http://code.google.com/chrome/apps/docs/background.html">backgro
und window</a>. |
| 431 </p> |
| 432 </td> |
| 433 </tr> |
| 434 <tr> |
| 435 <td> "bookmarks" </td> |
| 436 <td> Required if the extension uses the |
| 437 <a href="bookmarks.html">chrome.bookmarks</a> module. </td> |
| 438 </tr> |
| 439 <tr> |
| 440 <td> "chrome://favicon/" </td> |
| 441 <td> Required if the extension uses the |
| 442 "chrome://favicon/<em>url</em>" mechanism |
| 443 to display the favicon of a page. |
| 444 For example, to display the favicon of http://www.google.com/, |
| 445 you declare the "chrome://favicon/" permission |
| 446 and use HTML code like this: |
| 447 <pre><img src="chrome://favicon/http://www.google.com/"></pre> |
| 448 </td> |
| 449 </tr> |
| 450 <tr> |
| 451 <td> "clipboardRead" </td> |
| 452 <td> Required if the extension uses |
| 453 <code>document.execCommand('paste')</code>. </td> |
| 454 </tr> |
| 455 <tr> |
| 456 <td> "clipboardWrite" </td> |
| 457 <td> Indicates the app or extension uses |
| 458 <code>document.execCommand('copy')</code> or |
| 459 <code>document.execCommand('cut')</code>. This permission is <b>required |
| 460 for hosted apps</b>; it's recommended for extensions and packaged apps. |
| 461 </td> |
| 462 </tr> |
| 463 <tr> |
| 464 <td> "contentSettings" </td> |
| 465 <td> Required if the extension uses the |
| 466 <a href="contentSettings.html">chrome.contentSettings</a> module. </td> |
| 467 </tr> |
| 468 <tr> |
| 469 <td> "contextMenus" </td> |
| 470 <td> Required if the extension uses the |
| 471 <a href="contextMenus.html">chrome.contextMenus</a> module. </td> |
| 472 </tr> |
| 473 <tr> |
| 474 <td> "cookies" </td> |
| 475 <td> Required if the extension uses the |
| 476 <a href="cookies.html">chrome.cookies</a> module. </td> |
| 477 </tr> |
| 478 <tr> |
| 479 <td> "experimental" </td> |
| 480 <td> Required if the extension uses any |
| 481 <a href="http://code.google.com/chrome/extensions/dev/experimental.html">
chrome.experimental.* APIs</a>.</td> |
| 482 </tr> |
| 483 <tr> |
| 484 <td id="fileBrowserHandler"> "fileBrowserHandler" </td> |
| 485 <td> Required if the extension uses the |
| 486 <a href="fileBrowserHandler.html">fileBrowserhandler</a> module. </td> |
| 487 </tr> |
| 488 <tr> |
| 489 <td id="geolocation"> "geolocation" </td> |
| 490 <td> Allows the extension to use the proposed HTML5 |
| 491 <a href="http://dev.w3.org/geo/api/spec-source.html">geolocation API</a> |
| 492 without prompting the user for permission. </td> |
| 493 </tr> |
| 494 <tr> |
| 495 <td> "history" </td> |
| 496 <td> Required if the extension uses the |
| 497 <a href="history.html">chrome.history</a> module. </td> |
| 498 </tr> |
| 499 <tr> |
| 500 <td> "idle" </td> |
| 501 <td> Required if the extension uses the |
| 502 <a href="idle.html">chrome.idle</a> module. </td> |
| 503 </tr> |
| 504 <tr> |
| 505 <td> "management" </td> |
| 506 <td> Required if the extension uses the |
| 507 <a href="management.html">chrome.management</a> module. </td> |
| 508 </tr> |
| 509 <tr> |
| 510 <td> "notifications" </td> |
| 511 <td> Allows the extension to use the proposed HTML5 |
| 512 <a href="http://www.chromium.org/developers/design-documents/desktop-noti
fications/api-specification">notification API</a> |
| 513 without calling permission methods |
| 514 (such as <code>checkPermission()</code>). |
| 515 For more information see |
| 516 <a href="notifications.html">Desktop Notifications</a>.</td> |
| 517 </tr> |
| 518 <tr> |
| 519 <td> "privacy" </td> |
| 520 <td> Required if the extension uses the |
| 521 <a href="privacy.html">chrome.privacy</a> module. </td> |
| 522 </tr> |
| 523 <tr> |
| 524 <td> "proxy" </td> |
| 525 <td> Required if the extension uses the |
| 526 <a href="proxy.html">chrome.proxy</a> module. </td> |
| 527 </tr> |
| 528 <tr> |
| 529 <td> "storage" </td> |
| 530 <td> Required if the extension uses the |
| 531 <a href="storage.html">chrome.storage</a> module. </td> |
| 532 </tr> |
| 533 <tr> |
| 534 <td> "tabs" </td> |
| 535 <td> Required if the extension uses the |
| 536 <a href="tabs.html">chrome.tabs</a> or |
| 537 <a href="windows.html">chrome.windows</a> module. </td> |
| 538 </tr> |
| 539 <tr> |
| 540 <td> "tts" </td> |
| 541 <td> Required if the extension uses the |
| 542 <a href="tts.html">chrome.tts</a> module. </td> |
| 543 </tr> |
| 544 <tr> |
| 545 <td> "ttsEngine" </td> |
| 546 <td> Required if the extension uses the |
| 547 <a href="ttsEngine.html">chrome.ttsEngine</a> module. </td> |
| 548 </tr> |
| 549 <tr> |
| 550 <td> "unlimitedStorage"</td> |
| 551 <td> Provides an unlimited quota for storing HTML5 client-side data, |
| 552 such as databases and local storage files. |
| 553 Without this permission, the extension is limited to |
| 554 5 MB of local storage. |
| 555 <p class="note"> |
| 556 <b>Note:</b> |
| 557 This permission applies only to Web SQL Database and application cache |
| 558 (see issue <a href="http://crbug.com/58985">58985</a>). |
| 559 Also, it doesn't currently work with wildcard subdomains such as |
| 560 <code>http://*.example.com</code>. |
| 561 </p> |
| 562 </td> |
| 563 <tr> |
| 564 <tr> |
| 565 <td> "webNavigation" </td> |
| 566 <td> Required if the extension uses the |
| 567 <a href="webNavigation.html">chrome.webNavigation</a> module. </td> |
| 568 </tr> |
| 569 <tr> |
| 570 <td> "webRequest" </td> |
| 571 <td> Required if the extension uses the |
| 572 <a href="webRequest.html">chrome.webRequest</a> module. </td> |
| 573 </tr> |
| 574 <tr> |
| 575 <td> "webRequestBlocking" </td> |
| 576 <td> Required if the extension uses the |
| 577 <a href="webRequest.html">chrome.webRequest</a> module in a blocking |
| 578 fashion. </td> |
| 579 </tr> |
| 580 </tr> |
| 581 </table> |
| 582 <h3 id="requirements">requirements</h3> |
| 583 <p> |
| 584 Technologies required by the app or extension. |
| 585 Hosting sites such as the Chrome Web Store may use this list |
| 586 to dissuade users from installing apps or extensions |
| 587 that will not work on their computer. |
| 588 </p> |
| 589 <p> |
| 590 The only supported requirement is "3D", |
| 591 which denotes GPU hardware acceleration. |
| 592 For that requirement, |
| 593 you can list the 3D-related features your app requires, |
| 594 as demonstrated in the following example: |
| 595 </p> |
| 596 <pre> |
| 597 "requirements": { |
| 598 "3D": { |
| 599 "features": ["css3d", "webgl"] |
| 600 } |
| 601 } |
| 602 </pre> |
| 603 <p> |
| 604 The "css3d" requirement refers to the |
| 605 <a href="http://www.w3.org/TR/css3-3d-transforms/">CSS 3D Transforms specificati
on</a>, |
| 606 and the "webgl" requirement refers to the |
| 607 <a href="http://www.khronos.org/webgl/">WebGL API</a>. |
| 608 For more information on Chrome 3D graphics support, |
| 609 see the help article on |
| 610 <a href="http://www.google.com/support/chrome/bin/answer.py?answer=1220892">WebG
L and 3D graphics</a>. |
| 611 Support for additional requirements checks may be added in the future. |
| 612 </p> |
| 613 <h3 id="version">version</h3> |
| 614 <p> |
| 615 One to four dot-separated integers |
| 616 identifying the version of this extension. |
| 617 A couple of rules apply to the integers: |
| 618 they must be between 0 and 65535, inclusive, |
| 619 and non-zero integers can't start with 0. |
| 620 For example, 99999 and 032 are both invalid. |
| 621 </p> |
| 622 <p> |
| 623 Here are some examples of valid versions: |
| 624 </p> |
| 625 <ul> |
| 626 <li> <code>"version": "1"</code> </li> |
| 627 <li> <code>"version": "1.0"</code> </li> |
| 628 <li> <code>"version": "2.10.2"</code> </li> |
| 629 <li> <code>"version": "3.1.2.4567"</code> </li> |
| 630 </ul> |
| 631 <p> |
| 632 The autoupdate system compares versions |
| 633 to determine whether an installed extension |
| 634 needs to be updated. |
| 635 If the published extension has a newer version string |
| 636 than the installed extension, |
| 637 then the extension is automatically updated. |
| 638 </p> |
| 639 <p> |
| 640 The comparison starts with the leftmost integers. |
| 641 If those integers are equal, |
| 642 the integers to the right are compared, |
| 643 and so on. |
| 644 For example, 1.2.0 is a newer version than 1.1.9.9999. |
| 645 </p> |
| 646 <p> |
| 647 A missing integer is equal to zero. |
| 648 For example, 1.1.9.9999 is newer than 1.1. |
| 649 </p> |
| 650 <p> |
| 651 For more information, see |
| 652 <a href="autoupdate.html">Autoupdating</a>. |
| 653 </p> |
| 654 <h3 id="manifest_version">manifest_version</h3> |
| 655 <p> |
| 656 One integer specifying the version of the manifest file format your package |
| 657 requires. As of Chrome 18, developers <em>should</em> specify <code>2</code> |
| 658 (without quotes) to use the format as described by this document: |
| 659 </p> |
| 660 <pre>"manifest_version": 2</pre> |
| 661 <p> |
| 662 Consider manifest version 1 <em>deprecated</em> as of Chrome 18. Version 2 is |
| 663 not yet <em>required</em>, but we will, at some point in the not-too-distant |
| 664 future, stop supporting packages using deprecated manifest versions. Extensions, |
| 665 applications, and themes that aren't ready to make the jump to the new manifest |
| 666 version in Chrome 18 can either explicitly specify version <code>1</code>, or |
| 667 leave the key off entirely. |
| 668 </p> |
| 669 <p> |
| 670 The changes between version 1 and version 2 of the manifest file format are |
| 671 described in detail in <a href="manifestVersion.html">the |
| 672 <code>manifest_version</code> documentation.</a> |
| 673 </p> |
| 674 <p class="caution"> |
| 675 Setting <code>manifest_version</code> 2 in Chrome 17 or lower is not |
| 676 recommended. If your extension needs to work in older versions of Chrome, |
| 677 stick with version 1 for the moment. We'll give you ample warning before |
| 678 version 1 stops working. |
| 679 </p> |
| 680 <h3 id="web_accessible_resources">web_accessible_resources</h3> |
| 681 <p> |
| 682 An array of strings specifying the paths (relative to the package root) of |
| 683 packaged resources that are expected to be usable in the context of a web page. |
| 684 For example, an extension that injects a content script with the intention of |
| 685 building up some custom interface for <code>example.com</code> would whitelist |
| 686 any resources that interface requires (images, icons, stylesheets, scripts, |
| 687 etc.) as follows: |
| 688 </p> |
| 689 <pre>{ |
| 690 ... |
| 691 "web_accessible_resources": [ |
| 692 "images/my-awesome-image1.png", |
| 693 "images/my-amazing-icon1.png", |
| 694 "style/double-rainbow.css", |
| 695 "script/double-rainbow.js" |
| 696 ], |
| 697 ... |
| 698 }</pre> |
| 699 <p> |
| 700 These resources would then be available in a webpage via the URL |
| 701 <code>chrome-extension://[PACKAGE ID]/[PATH]</code>, which can be generated with |
| 702 the <a href="extension.html#method-getURL"> |
| 703 <code>chrome.extension.getURL</code> |
| 704 </a> method. Whitelisted resources are served with appropriate |
| 705 <a href="http://www.w3.org/TR/cors/">CORS</a> headers, so they're available via |
| 706 mechanisms like XHR. |
| 707 </p> |
| 708 <p> |
| 709 Injected content scripts themselves do not need to be whitelisted. |
| 710 </p> |
| 711 <p> |
| 712 Prior to manifest version 2 all resources within an extension could be accessed |
| 713 from any page on the web. This allowed a malicious website to |
| 714 <a href="http://en.wikipedia.org/wiki/Device_fingerprint">fingerprint</a> the |
| 715 extensions that a user has installed or exploit vulnerabilities (for example |
| 716 <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">XSS bugs</a>)within |
| 717 installed extensions. Limiting availability to only resources which are |
| 718 explicitly intended to be web accessible serves to both minimize the available |
| 719 attack surface and protect the privacy of users. |
| 720 </p> |
| 721 <h4>Default Availability</h4> |
| 722 <p> |
| 723 Resources inside of packages using <a href="#manifest_version"><code>manifest_ve
rsion</code></a> |
| 724 2 or above are <strong>blocked by default</strong>, and must be whitelisted |
| 725 for use via this property. |
| 726 </p> |
| 727 <p> |
| 728 Resources inside of packages using <code>manifest_version</code> 1 are available |
| 729 by default, but <em>if</em> you do set this property, then it will be treated as |
| 730 a complete list of all whitelisted resources. Resources not listed will be |
| 731 blocked. |
| 732 </p> |
| 733 <h3 id="sandbox">sandbox</h3> |
| 734 <p> |
| 735 Defines an collection of app or extension pages that are to be served |
| 736 in a sandboxed unique origin, and optionally a Content Security Policy to use |
| 737 with them. Being in a sandbox has two implications: |
| 738 </p> |
| 739 <ol> |
| 740 <li>A sandboxed page will not have access to extension or app APIs, or |
| 741 direct access to non-sandboxed pages (it may communicate with them via |
| 742 <code>postMessage()</code>).</li> |
| 743 <li> |
| 744 <p>A sandboxed page is not subject to the |
| 745 <a href="../extensions/contentSecurityPolicy.html">Content Security Policy |
| 746 (CSP)</a> used by the rest of the app or extension (it has its own separate |
| 747 CSP value). This means that, for example, it can use inline script and |
| 748 <code>eval</code>.</p> |
| 749 <p>For example, here's how to specify that two extension pages are to be |
| 750 served in a sandbox with a custom CSP:</p> |
| 751 <pre>{ |
| 752 ... |
| 753 "sandbox": { |
| 754 "pages": [ |
| 755 "page1.html", |
| 756 "directory/page2.html" |
| 757 ] |
| 758 <i>// content_security_policy is optional.</i> |
| 759 "content_security_policy": |
| 760 "sandbox allow-scripts; script-src https://www.google.com" |
| 761 ], |
| 762 ... |
| 763 }</pre> |
| 764 <p> |
| 765 If not specified, the default <code>content_security_policy</code> value is |
| 766 <code>sandbox allow-scripts allow-forms</code>. You can specify your CSP |
| 767 value to restrict the sandbox even further, but it must have the <code>sandbox
</code> |
| 768 directive and may not have the <code>allow-same-origin</code> token (see |
| 769 <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-ifram
e-element.html#attr-iframe-sandbox">the |
| 770 HTML5 specification</a> for possible sandbox tokens). |
| 771 </p> |
| 772 </li> |
| 773 </ol> |
| 774 <p> |
| 775 Note that you only need to list pages that you expected to be loaded in |
| 776 windows or frames. Resources used by sandboxed pages (e.g. stylesheets or |
| 777 JavaScript source files) do not need to appear in the |
| 778 <code>sandboxed_page</code> list, they will use the sandbox of the page |
| 779 that embeds them. |
| 780 </p> |
| 781 <p> |
| 782 <a href="sandboxingEval.html">"Using eval in Chrome Extensions. Safely."</a> |
| 783 goes into more detail about implementing a sandboxing workflow that enables use |
| 784 of libraries that would otherwise have issues executing under extension's |
| 785 <a href="../extensions/contentSecurityPolicy.html">default Content Security |
| 786 Policy</a>. |
| 787 </p> |
| 788 <p> |
| 789 Sandboxed page may only be specified when using |
| 790 <a href="#manifest_version"><code>manifest_version</code></a> 2 or above. |
| 791 </p> |
OLD | NEW |