1 <div id="pageData-name" class="pageData">Formats: Manifest Files</div> 2 <div id="pageData-showTOC" class="pageData">true</div> 3 4 <p> 5 Every extension, installable web app, and theme has a 6 <a href="http://www.json.org">JSON</a>-formatted manifest file, 7 named <code>manifest.json</code>, 8 that provides important information. 9 </p> 10 11 <h2 id="overview"> Field summary </h2> 12 13 <p> 14 The following code shows the supported manifest fields, 15 with links to the page that discusses each field. 16 The only fields that are always required 17 are <b>name</b> and <b>version</b>. 18 </p> 19 20 <pre> 21 { 22 <em>// Required</em> 23 "<a href="#name">name</a>": "<em>My Extension</em>", 24 "<a href="#version">version</a>": "<em>versionString</em>", 25 26 <em>// Recommended</em> 27 "<a href="#description">description</a>": "<em>A plain text description</em>", 28 "<a href="#icons">icons</a>": { ... }, 29 "<a href="#default_locale">default_locale</a>": "<em>en</em>", 30 31 <em>// Pick one (or none)</em> 32 "<a href="browserAction.html">browser_action</a>": {...}, 33 "<a href="pageAction.html">page_action</a>": {...}, 34 "<a href="themes.html">theme</a>": {...}, 35 "<a href="#app">app</a>": {...}, 36 37 <em>// Add any of these that you need</em> 38 "<a href="background_pages.html">background_page</a>": "<em>aFile</em>.html", 39 "<a href="override.html">chrome_url_overrides</a>": {...}, 40 "<a href="content_scripts.html">content_scripts</a>": [...], 41 "<a href="#homepage_url">homepage_url</a>": "http://<em>path/to/homepage</em>", 42 "<a href="#incognito">incognito</a>": "spanning" <em>or</em> "split", 43 "<a href="#key">key</a>": "<em>publicKey</em>", 44 "<a href="#minimum_chrome_version">minimum_chrome_version</a>": "<em>versionString</em>", 45 "<a href="omnibox.html">omnibox</a>": { "keyword" : "<em>aString</em>" }, 46 "<a href="options.html">options_page</a>": "<em>aFile</em>.html", 47 "<a href="#permissions">permissions</a>": [...], 48 "<a href="npapi.html">plugins</a>": [...], 49 "<a href="autoupdate.html">update_url</a>": "http://<em>path/to/updateInfo</em>.xml" 50 } 51 </pre> 52 53 54 <h2>Field details</h2> 55 56 <p> 57 This section covers fields that aren't described in another page. 58 For a complete list of fields, 59 with links to where they're described in detail, 60 see the <a href="#overview">Field summary</a>. 61 </p> 62 63 64 <h3 id="app">app</h3> 65 66 <p> 67 Used by installable web apps, 68 including packaged apps, 69 to specify the URLs that the app uses. 70 Most important is the <em>launch page</em> for the app—the 71 page that the browser goes to when the user clicks the app's icon 72 in the New Tab page. 73 </p> 74 75 <p> 76 For details, see the documentation for 77 <a href="http://code.google.com/chrome/apps/docs/developers_guide.html">hosted apps</a> and 78 <a href="apps.html">packaged apps</a>. 79 </p> 80 81 <h3 id="default_locale">default_locale</h3> 82 83 <p> 84 Specifies the subdirectory of <code>_locales</code> 85 that contains the default strings for this extension. 86 This field is <b>required</b> in extensions 87 that have a <code>_locales</code> directory; 88 it <b>must be absent</b> in extensions 89 that have no <code>_locales</code> directory. 90 For details, see 91 <a href="i18n.html">Internationalization</a>. 92 </p> 93 94 <h3 id="description">description</h3> 95 96 <p> 97 A plain text string 98 (no HTML or other formatting; 99 no more than 132 characters) 100 that describes the extension. 101 The description should be suitable for both 102 the browser's extension management UI 103 and the <a href="https://chrome.google.com/webstore">Chrome Web Store</a>. 104 You can specify locale-specific strings for this field; 105 see <a href="i18n.html">Internationalization</a> for details. 106 </p> 107 108 <h3 id="homepage_url">homepage_url</h3> 109 110 <p> 111 The URL of the homepage for this extension. The extensions management page (chrome://extensions) 112 will contain a link to this URL. This field is particularly useful if you 113 <a href="hosting.html">host the extension on your own site</a>. If you distribute your 114 extension using the <a href="https://chrome.google.com/extensions">Extensions Gallery</a> or <a href="https://chrome.google.com/webstore">Chrome Web Store</a>, 115 the homepage URL defaults to the extension's own page. 116 </p> 117 118 <h3 id="icons">icons</h3> 119 120 <p> 121 One or more icons that represent the extension, app, or theme. 122 You should always provide a 128x128 icon; 123 it's used during installation and by the Chrome Web Store. 124 Extensions should also provide a 48x48 icon, 125 which is used in the extensions management page 126 (chrome://extensions). 127 You can also specify a 16x16 icon to be used as the favicon 128 for an extension's pages. 129 The 16x16 icon is also displayed in the experimental extension 130 <a href="experimental.infobars.html">infobar</a> 131 feature. 132 </p> 133 134 <p> 135 Icons should generally be in PNG format, 136 because PNG has the best support for transparency. 137 They can, however, be in any format supported by WebKit, 138 including BMP, GIF, ICO, and JPEG. 139 Here's an example of specifying the icons: 140 </p> 141 142 <pre> 143 "icons": { "16": "icon16.png", 144 "48": "icon48.png", 145 "128": "icon128.png" }, 146 </pre> 147 148 <p class="note"> 149 <b>Important:</b> 150 Use only the documented icon sizes. 151 <br><br> 152 You might notice that Chrome sometimes resizes these icons down to smaller 153 sizes. For example, the install dialog might shrink the 128-pixel 154 icon down to 69 pixels. 155 <br><br> 156 However, the details of 157 Chrome's UI may change between versions, and these changes assume that 158 developers are using the documented sizes. If you use other sizes, 159 your icon may look bad in future versions of the browser. 160 </p> 161 162 <p> 163 If you upload your extension, app, or theme using the 164 <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Developer Dashboard</a>, 165 you'll need to upload additional images, 166 including at least one screenshot of your extension. 167 For more information, 168 see the 169 <a href="http://code.google.com/chrome/webstore/">Chrome Web Store 170 developer documentation</a>. 171 </p> 172 173 <h3 id="incognito">incognito</h3> 174 175 <p> 176 Either "spanning" or "split", to specify how this extension will 177 behave if allowed to run in incognito mode. 178 </p> 179 180 <p> 181 The default for extensions is "spanning", which means that the extension 182 will run in a single shared process. Any events or messages from an incognito 183 tab will be sent to the shared process, with an <em>incognito</em> flag 184 indicating where it came from. 185 </p> 186 187 <p> 188 The default for installable web apps is "split", 189 which means that all app pages in 190 an incognito window will run in their own incognito process. If the app or extension contains a background page, that will also run in the incognito process. 191 This incognito process runs along side the regular process, but has a separate 192 memory-only cookie store. Each process sees events and messages only from its 193 own context (for example, the incognito process will see only incognito tab updates). 194 The processes are unable to communicate with each other. 195 </p> 196 197 <p> 198 As a rule of thumb, if your extension or app needs to load a tab in an incognito browser, use 199 <em>split</em> incognito behavior. If your extension or app needs to be logged 200 into a remote server or persist settings locally, use <em>spanning</em> 201 incognito behavior. 202 </p> 203 204 <h3 id="key">key</h3> 205 206 <p> 207 This value can be used to control 208 the unique ID of an extension, app, or theme when 209 it is loaded during development. 210 </p> 211 212 <p class="note"> 213 <b>Note:</b> You don't usually need to 214 use this value. Instead, write your 215 code so that the key value doesn't matter 216 by using <a href="overview.html#relative-urls">relative paths</a> 217 and <a href="extension.html#method-getURL">chrome.extension.getURL()</a>. 218 </p> 219 220 <p> 221 To get a suitable key value, first 222 install your extension from a <code>.crx</code> file 223 (you may need to 224 <a href="https://chrome.google.com/webstore/developer/dashboard">upload your extension</a> 225 or <a href="packaging.html">package it manually</a>). 226 Then, in your 227 <a href="http://www.chromium.org/user-experience/user-data-directory">user 228 data directory</a>, look in the file 229 <code>Default/Extensions/<em><extensionId></em>/<em><versionString></em>/manifest.json</code>. 230 You will see the key value filled in there. 231 </p> 232 233 <h3 id="minimum_chrome_version">minimum_chrome_version</h3> 234 235 <p> 236 The version of Chrome that your extension, app, or theme requires, if any. 237 The format for this string is the same as for the 238 <a href="#version">version</a> field. 239 240 <h3 id="name">name</h3> 241 242 <p> 243 A short, plain text string 244 (no more than 45 characters) 245 that identifies the extension. 246 The name is used in the install dialog, 247 extension management UI, 248 and the <a href="https://chrome.google.com/webstore">store</a>. 249 You can specify locale-specific strings for this field; 250 see <a href="i18n.html">Internationalization</a> for details. 251 </p> 252 253 <h3 id="permissions">permissions</h3> 254 255 <p> 256 An array of permissions that the extension or app might use. 257 Each permission can be either one of a list of known strings 258 (such as "geolocation") 259 or a match pattern 260 that gives access to one or more hosts. 261 Permissions can help to limit damage 262 if your extension or app is attacked. 263 Some permissions are also displayed to users before installation, 264 as detailed in 265 <a href="permission_warnings.html">Permission Warnings</a>. 266 </p> 267 268 <p> 269 If an extension API requires you to declare a permission in the manifest, 270 then its documentation tells you how to do so. 271 For example, 272 the <a href="tabs.html">Tabs</a> page 273 shows you how to 274 declare the "tabs" permission. 275 </p> 276 277 <p> 278 Here's an example of the permissions part of a manifest file 279 for an extension: 280 </p> 281 282 <pre> 283 "permissions": [ 284 "tabs", 285 "bookmarks", 286 "http://www.blogger.com/", 287 "http://*.google.com/", 288 "unlimitedStorage" 289 ], 290 </pre> 291 292 <p> 293 The following table lists the permissions an extension 294 or packaged app can use. 295 </p> 296 297 <p class="note"> 298 <strong>Note:</strong> 299 Hosted apps can use the 300 "background", "geolocation", "notifications", and "unlimitedStorage" permissions, 301 but not any other permissions listed in this table. 302 </p> 303 304 <table> 305 <tr> 306 <th> Permission </th> <th> Description </th> 307 </tr> 308 <tr> 309 <td> <em>match pattern</em> </td> 310 <td> Specifies a <em>host permission</em>. 311 Required if the extension wants to interact 312 with the code running on pages. 313 Many extension capabilities, such as 314 <a href="xhr.html">cross-origin XMLHttpRequests</a>, 315 <a href="content_scripts.html#pi">programmatically injected 316 content scripts</a>, and <a href="cookies.html">the cookies API</a> 317 require host permissions. For details on the syntax, see 318 <a href="match_patterns.html">Match Patterns</a>. 319 </td> 320 </tr> 321 <tr id="bg"> 322 <td> "background" </td> 323 <td> <p> 324 Makes Chrome start up early and and shut down late, 325 so that apps and extensions can have a longer life. 326 </p> 327 328 <p> 329 When any installed hosted app, packaged app, or extension 330 has "background" permission, Chrome runs (invisibly) 331 as soon as the user logs into their computer—before 332 the user launches Chrome. 333 The "background" permission also makes Chrome continue running 334 (even after its last window is closed) 335 until the user explicitly quits Chrome. 336 </p> 337 338 <p class="note"> 339 <b>Note:</b> 340 Disabled apps and extensions 341 are treated as if they aren't installed. 342 </p> 343 344 <p> 345 You typically use the "background" permission with a 346 <a href="background_pages.html">background page</a> 347 or (for hosted apps) a 348 <a href="http://code.google.com/chrome/apps/docs/background.html">background window</a>. 349 </p> 350 </td> 351 </tr> 352 <tr> 353 <td> "bookmarks" </td> 354 <td> Required if the extension uses the 355 <a href="bookmarks.html">chrome.bookmarks</a> module. </td> 356 </tr> 357 <tr> 358 <td> "chrome://favicon/" </td> 359 <td> Required if the extension uses the 360 "chrome://favicon/<em>url</em>" mechanism 361 to display the favicon of a page. 362 For example, to display the favicon of http://www.google.com/, 363 you declare the "chrome://favicon/" permission 364 and use HTML code like this: 365 <pre><img src="chrome://favicon/http://www.google.com/"></pre> 366 </td> 367 </tr> 368 <tr> 369 <td> "contextMenus" </td> 370 <td> Required if the extension uses the 371 <a href="contextMenus.html">chrome.contextMenus</a> module. </td> 372 </tr> 373 <tr> 374 <td> "cookies" </td> 375 <td> Required if the extension uses the 376 <a href="cookies.html">chrome.cookies</a> module. </td> 377 </tr> 378 <tr> 379 <td> "experimental" </td> 380 <td> Required if the extension uses any 381 <a href="http://code.google.com/chrome/extensions/dev/experimental.html">chrome.experimental.* APIs</a>.</td> 382 </tr> 383 <tr> 384 <td id="geolocation"> "geolocation" </td> 385 <td> Allows the extension to use the proposed HTML5 386 <a href="http://dev.w3.org/geo/api/spec-source.html">geolocation API</a> 387 without prompting the user for permission. </td> 388 </tr> 389 <tr> 390 <td> "history" </td> 391 <td> Required if the extension uses the 392 <a href="history.html">chrome.history</a> module. </td> 393 </tr> 394 <tr> 395 <td> "idle" </td> 396 <td> Required if the extension uses the 397 <a href="idle.html">chrome.idle</a> module. </td> 398 </tr> 399 <tr> 400 <td> "management" </td> 401 <td> Required if the extension uses the 402 <a href="management.html">chrome.management</a> module. </td> 403 </tr> 404 <tr> 405 <td> "notifications" </td> 406 <td> Allows the extension to use the proposed HTML5 407 <a href="http://www.chromium.org/developers/design-documents/desktop-notifications/api-specification">notification API</a> 408 without calling permission methods 409 (such as <code>checkPermission()</code>). 410 For more information see 411 <a href="notifications.html">Desktop Notifications</a>.</td> 412 </tr> 413 <tr> 414 <td> "tabs" </td> 415 <td> Required if the extension uses the 416 <a href="tabs.html">chrome.tabs</a> or 417 <a href="windows.html">chrome.windows</a> module. </td> 418 </tr> 419 <tr> 420 <td> "unlimitedStorage"</td> 421 <td> Provides an unlimited quota for storing HTML5 client-side data, 422 such as databases and local storage files. 423 Without this permission, the extension is limited to 424 5 MB of local storage. 425 426 <p class="note"> 427 <b>Note:</b> 428 This permission applies only to Web SQL Database and application cache 429 (see issue <a href="http://crbug.com/58985">58985</a>). 430 Also, it doesn't currently work with wildcard subdomains such as 431 <code>http://*.example.com</code>. 432 </p> 433 </td> 434 </tr> 435 </table> 436 437 438 <h3 id="version">version</h3> 439 440 <p> 441 One to four dot-separated integers 442 identifying the version of this extension. 443 A couple of rules apply to the integers: 444 they must be between 0 and 65535, inclusive, 445 and non-zero integers can't start with 0. 446 For example, 99999 and 032 are both invalid. 447 </p> 448 449 <p> 450 Here are some examples of valid versions: 451 </p> 452 453 <ul> 454 <li> <code>"version": "1"</code> </li> 455 <li> <code>"version": "1.0"</code> </li> 456 <li> <code>"version": "2.10.2"</code> </li> 457 <li> <code>"version": "3.1.2.4567"</code> </li> 458 </ul> 459 460 <p> 461 The autoupdate system compares versions 462 to determine whether an installed extension 463 needs to be updated. 464 If the published extension has a newer version string 465 than the installed extension, 466 then the extension is automatically updated. 467 </p> 468 469 <p> 470 The comparison starts with the leftmost integers. 471 If those integers are equal, 472 the integers to the right are compared, 473 and so on. 474 For example, 1.2.0 is a newer version than 1.1.9.9999. 475 </p> 476 477 <p> 478 A missing integer is equal to zero. 479 For example, 1.1.9.9999 is newer than 1.1. 480 </p> 481 482 <p> 483 For more information, see 484 <a href="autoupdate.html">Autoupdating</a>. 485 </p> 486 487 <!-- [PENDING: Possibly: point to the store/dashboard and make a big deal of the fact that autoupdating is free if you use them.] --> 488