apps.html revision ddb351dbec246cf1fab5ec20d2d5520909041de1
1<!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc. Note: 2 1) The <head> information in this page is significant, should be uniform 3 across api docs and should be edited only with knowledge of the 4 templating mechanism. 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a 6 browser, it will be re-generated from the template, json schema and 7 authored overview content. 8 4) The <body>.innerHTML is also generated by an offline step so that this 9 page may easily be indexed by search engines. 10--><html xmlns="http://www.w3.org/1999/xhtml"><head> 11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> 13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print"> 14 <script type="text/javascript" src="/third_party/jstemplate/jstemplate_compiled.js"> 15 </script> 16 <script type="text/javascript" src="js/api_page_generator.js"></script> 17 <script type="text/javascript" src="js/bootstrap.js"></script> 18 <script type="text/javascript" src="js/sidebar.js"></script> 19 <title>Packaged Apps - Google Chrome Extensions - Google Code</title></head> 20 <body> <div id="gc-container" class="labs"> 21 <div id="devModeWarning"> 22 You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files. 23 </div> 24 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> 25 <!-- In particular, sub-templates that recurse, must be used by allowing 26 jstemplate to make a copy of the template in this section which 27 are not operated on by way of the jsskip="true" --> 28 <div style="display:none"> 29 30 <!-- VALUE --> 31 <div id="valueTemplate"> 32 <dt> 33 <var>paramName</var> 34 <em> 35 36 <!-- TYPE --> 37 <div style="display:inline"> 38 ( 39 <span class="optional">optional</span> 40 <span class="enum">enumerated</span> 41 <span id="typeTemplate"> 42 <span> 43 <a> Type</a> 44 </span> 45 <span> 46 <span> 47 array of <span><span></span></span> 48 </span> 49 <span>paramType</span> 50 <span></span> 51 </span> 52 </span> 53 ) 54 </div> 55 56 </em> 57 </dt> 58 <dd class="todo"> 59 Undocumented. 60 </dd> 61 <dd> 62 Description of this parameter from the json schema. 63 </dd> 64 <dd> 65 This parameter was added in version 66 <b><span></span></b>. 67 You must omit this parameter in earlier versions, 68 and you may omit it in any version. If you require this 69 parameter, the manifest key 70 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 71 can ensure that your extension won't be run in an earlier browser version. 72 </dd> 73 74 <!-- OBJECT PROPERTIES --> 75 <dd> 76 <dl> 77 <div> 78 <div> 79 </div> 80 </div> 81 </dl> 82 </dd> 83 84 <!-- OBJECT METHODS --> 85 <dd> 86 <div></div> 87 </dd> 88 89 <!-- OBJECT EVENT FIELDS --> 90 <dd> 91 <div></div> 92 </dd> 93 94 <!-- FUNCTION PARAMETERS --> 95 <dd> 96 <div></div> 97 </dd> 98 99 </div> <!-- /VALUE --> 100 101 <div id="functionParametersTemplate"> 102 <h5>Parameters</h5> 103 <dl> 104 <div> 105 <div> 106 </div> 107 </div> 108 </dl> 109 </div> 110 </div> <!-- /SUBTEMPLATES --> 111 112 <a id="top"></a> 113 <div id="skipto"> 114 <a href="#gc-pagecontent">Skip to page content</a> 115 <a href="#gc-toc">Skip to main navigation</a> 116 </div> 117 <!-- API HEADER --> 118 <table id="header" width="100%" cellspacing="0" border="0"> 119 <tbody><tr> 120 <td valign="middle"><a href="http://code.google.com/"><img src="images/code_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border:0; margin:0;"></a></td> 121 <td valign="middle" width="100%" style="padding-left:0.6em;"> 122 <form action="http://www.google.com/cse" id="cse" style="margin-top:0.5em"> 123 <div id="gsc-search-box"> 124 <input type="hidden" name="cx" value="002967670403910741006:61_cvzfqtno"> 125 <input type="hidden" name="ie" value="UTF-8"> 126 <input type="text" name="q" value="" size="55"> 127 <input class="gsc-search-button" type="submit" name="sa" value="Search"> 128 <br> 129 <span class="greytext">e.g. "page action" or "tabs"</span> 130 </div> 131 </form> 132 133 <script type="text/javascript" src="http://www.google.com/jsapi"></script> 134 <script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script> 135 <script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse&t13n_langs=en"></script> 136 <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse&lang=en"></script> 137 </td> 138 </tr> 139 </tbody></table> 140 141 <div id="codesiteContent" class=""> 142 143 <a id="gc-topnav-anchor"></a> 144 <div id="gc-topnav"> 145 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Labs</a>)</h1> 146 <ul id="home" class="gc-topnav-tabs"> 147 <li id="home_link"> 148 <a href="index.html" title="Google Chrome Extensions home page">Home</a> 149 </li> 150 <li id="docs_link"> 151 <a href="docs.html" title="Official Google Chrome Extensions documentation">Docs</a> 152 </li> 153 <li id="faq_link"> 154 <a href="faq.html" title="Answers to frequently asked questions about Google Chrome Extensions">FAQ</a> 155 </li> 156 <li id="samples_link"> 157 <a href="samples.html" title="Sample extensions (with source code)">Samples</a> 158 </li> 159 <li id="group_link"> 160 <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions" title="Google Chrome Extensions developer forum">Group</a> 161 </li> 162 </ul> 163 </div> <!-- end gc-topnav --> 164 165 <div class="g-section g-tpl-170"> 166 <!-- SIDENAV --> 167 <div class="g-unit g-first" id="gc-toc"> 168 <ul> 169 <li><a href="getstarted.html">Getting Started</a></li> 170 <li><a href="overview.html">Overview</a></li> 171 <li><a href="whats_new.html">What's New?</a></li> 172 <li><h2><a href="devguide.html">Developer's Guide</a></h2> 173 <ul> 174 <li>Browser UI 175 <ul> 176 <li><a href="browserAction.html">Browser Actions</a></li> 177 <li><a href="contextMenus.html">Context Menus</a></li> 178 <li><a href="notifications.html">Desktop Notifications</a></li> 179 <li><a href="omnibox.html">Omnibox</a></li> 180 <li><a href="options.html">Options Pages</a></li> 181 <li><a href="override.html">Override Pages</a></li> 182 <li><a href="pageAction.html">Page Actions</a></li> 183 </ul> 184 </li> 185 <li>Browser Interaction 186 <ul> 187 <li><a href="bookmarks.html">Bookmarks</a></li> 188 <li><a href="cookies.html">Cookies</a></li> 189 <li><a href="events.html">Events</a></li> 190 <li><a href="history.html">History</a></li> 191 <li><a href="management.html">Management</a></li> 192 <li><a href="tabs.html">Tabs</a></li> 193 <li><a href="windows.html">Windows</a></li> 194 </ul> 195 </li> 196 <li>Implementation 197 <ul> 198 <li><a href="a11y.html">Accessibility</a></li> 199 <li><a href="background_pages.html">Background Pages</a></li> 200 <li><a href="content_scripts.html">Content Scripts</a></li> 201 <li><a href="xhr.html">Cross-Origin XHR</a></li> 202 <li><a href="idle.html">Idle</a></li> 203 <li><a href="i18n.html">Internationalization</a></li> 204 <li><a href="messaging.html">Message Passing</a></li> 205 <li><a href="npapi.html">NPAPI Plugins</a></li> 206 </ul> 207 </li> 208 <li>Finishing 209 <ul> 210 <li><a href="hosting.html">Hosting</a></li> 211 <li><a href="external_extensions.html">Other Deployment Options</a></li> 212 </ul> 213 </li> 214 </ul> 215 </li> 216 <li><h2><a href="apps.html">Packaged Apps</a></h2></li> 217 <li><h2><a href="tutorials.html">Tutorials</a></h2> 218 <ul> 219 <li><a href="tut_debugging.html">Debugging</a></li> 220 <li><a href="tut_analytics.html">Google Analytics</a></li> 221 <li><a href="tut_oauth.html">OAuth</a></li> 222 </ul> 223 </li> 224 <li><h2>Reference</h2> 225 <ul> 226 <li>Formats 227 <ul> 228 <li><a href="manifest.html">Manifest Files</a></li> 229 <li><a href="match_patterns.html">Match Patterns</a></li> 230 </ul> 231 </li> 232 <li><a href="permission_warnings.html">Permission Warnings</a></li> 233 <li><a href="api_index.html">chrome.* APIs</a></li> 234 <li><a href="api_other.html">Other APIs</a></li> 235 </ul> 236 </li> 237 <li><h2><a href="samples.html">Samples</a></h2></li> 238 <div class="line"> </div> 239 <li><h2>More</h2> 240 <ul> 241 <li><a href="http://code.google.com/chrome/webstore/docs/index.html">Chrome Web Store</a></li> 242 <li><a href="http://code.google.com/chrome/apps/docs/developers_guide.html">Hosted Apps</a></li> 243 <li><a href="themes.html">Themes</a></li> 244 </ul> 245 </li> 246 </ul> 247 </div> 248 <script> 249 initToggles(); 250 </script> 251 252 <div class="g-unit" id="gc-pagecontent"> 253 <div id="pageTitle"> 254 <h1 class="page_title">Packaged Apps</h1> 255 </div> 256 <!-- TABLE OF CONTENTS --> 257 <div id="toc"> 258 <h2>Contents</h2> 259 <ol> 260 <li> 261 <a href="#overview">Overview</a> 262 <ol> 263 <li style="display: none; "> 264 <a>h3Name</a> 265 </li> 266 </ol> 267 </li><li> 268 <a href="#manifest"> The manifest </a> 269 <ol> 270 <li style="display: none; "> 271 <a>h3Name</a> 272 </li> 273 </ol> 274 </li><li> 275 <a href="#next">What next?</a> 276 <ol> 277 <li style="display: none; "> 278 <a>h3Name</a> 279 </li> 280 </ol> 281 </li> 282 <li style="display: none; "> 283 <a href="#apiReference">API reference</a> 284 <ol> 285 <li> 286 <a href="#properties">Properties</a> 287 <ol> 288 <li> 289 <a href="#property-anchor">propertyName</a> 290 </li> 291 </ol> 292 </li> 293 <li> 294 <a>Methods</a> 295 <ol> 296 <li> 297 <a href="#method-anchor">methodName</a> 298 </li> 299 </ol> 300 </li> 301 <li> 302 <a>Events</a> 303 <ol> 304 <li> 305 <a href="#event-anchor">eventName</a> 306 </li> 307 </ol> 308 </li> 309 <li> 310 <a href="#types">Types</a> 311 <ol> 312 <li> 313 <a href="#id-anchor">id</a> 314 </li> 315 </ol> 316 </li> 317 </ol> 318 </li> 319 </ol> 320 </div> 321 <!-- /TABLE OF CONTENTS --> 322 323 <!-- Standard content lead-in for experimental API pages --> 324 <p id="classSummary" style="display: none; "> 325 For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page. 326 </p> 327 328 <!-- STATIC CONTENT PLACEHOLDER --> 329 <div id="static"><div id="pageData-name" class="pageData">Packaged Apps</div> 330<div id="pageData-showTOC" class="pageData">true</div> 331 332<p> 333This page talks about packaged apps—how 334you implement them, 335and how they're different from 336extensions and ordinary web apps. 337</p> 338 339 340<h2 id="overview">Overview</h2> 341 342<p> 343A packaged app is a web app 344that's bundled into a <code>.crx</code> file 345and can use Chrome extension features. 346You build a packaged app just like you build an extension, 347except that a packaged app can't include a 348<a href="browserAction.html">browser action</a> or 349<a href="pageAction.html">page action</a>. 350Instead, a packaged app includes at least one HTML file 351within its <code>.crx</code> file 352that provides the app's user interface. 353</p> 354 355<p> 356Packaged apps are a type of 357<a href="http://code.google.com/chrome/apps/">installable web app</a>—a 358web app that can be installed in Chrome. 359The other type of installable web app is a 360<a href="http://code.google.com/chrome/apps/docs/developers_guide.html">hosted app</a>, 361which is an ordinary web app with a bit of additional metadata. 362</p> 363 364<p> 365If you're developing a web app for the Chrome Web Store, 366you might want to use a packaged app 367instead of a hosted app if any of the following are true: 368</p> 369 370<ul> 371 <li> 372 You don't want to run a service to host your app. 373 </li> 374 <li> 375 You want to build an app that works really well offline. 376 </li> 377 <li> 378 You want tighter integration with Chrome, 379 using the extension APIs. 380 </li> 381</ul> 382 383<p> 384To learn more about 385the differences between web apps and websites, 386extensions and packaged apps, and packaged apps and hosted apps, 387read these: 388</p> 389 390<ul> 391 <li> <a href="http://code.google.com/chrome/webstore/docs/choosing.html">Choosing an App Type</a> </li> 392 <li> <a href="http://code.google.com/chrome/apps/articles/thinking_in_web_apps.html">Thinking in Web Apps</a> </li> 393 <li> <a href="http://code.google.com/chrome/webstore/articles/apps_vs_extensions.html">Extensions, Packaged Apps, and Hosted Apps in the Chrome Web Store</a> </li> 394</ul> 395 396 397<h2 id="manifest"> The manifest </h2> 398 399<p> 400A packaged app's manifest can have any field 401that's available to extensions, 402except for "browser_action" and "page_action". 403In addition, a packaged app's manifest <b>must</b> 404have an "app" field. 405Here is a typical manifest for a packaged app: 406</p> 407 408<pre>{ 409 "name": "My Awesome Racing Game", 410 "description": "Enter a world where a Vanagon can beat a Maserati", 411 "version": "1", 412 <b>"app": { 413 "launch": { 414 "local_path": "main.html" 415 } 416 },</b> 417 "icons": { 418 "16": "icon_16.png", 419 "128": "icon_128.png" 420 } 421} 422</pre> 423 424<p> 425The "app" field has one subfield, "launch", 426which specifies the <em>launch page</em> for the app—the 427page (HTML file bundled into the <code>.crx</code> file) 428that the browser goes to when the user clicks the app's icon 429in the New Tab page. 430The "launch" field can contain the following: 431</p> 432 433<dl> 434 <dt>local_path:</dt> 435 <dd><em>Required.</em> 436 Specifies the launch page 437 as a relative path referring to a file 438 in the <code>.crx</code> package. 439 </dd> 440 <dt>container:</dt> 441 <dd> The value "panel" makes the app appear 442 in an app panel. 443 By default, or when you specify "tab", 444 the app appears in a tab. 445 446 <!-- PENDING: In the overview 447 (or somewhere else before here) 448 we should show and define both app panels and tabs. 449 We should link to that place from here. --> 450 </dd> 451 <dt>height:</dt> 452 <dd> 453 If the container is set to "panel", 454 this integer specifies the height 455 of the panel in pixels. 456 For example, you might specify 457 <code>"height":400</code>. 458 Note that you don't use quotation marks in the value. 459 This field specifies the height of the area 460 to display contents in; 461 window decorations add a few more pixels to the total height. 462 If the container isn't a panel, this field is ignored. 463 </dd> 464 <dt>width:</dt> 465 <dd> 466 Similar to "height", 467 but specifies the width of the panel. 468 </dd> 469 470</dl> 471 472<p> 473Packaged apps usually provide a 16x16 icon 474to be used as the favicon for 475tabs that contain app's pages. 476They also should provide a 128x128 icon, 477but not a 48x48 icon. 478See the manifest documentation for the 479<a href="manifest.html#icons">"icons" field</a> 480for more information. 481</p> 482 483<p> 484For further details on what a packaged app's manifest can contain, see the 485<a href="manifest.html">manifest documentation</a>. 486</p> 487 488<h2 id="next">What next?</h2> 489 490<p> 491Read the <a href="overview.html">Overview</a> to learn 492basic concepts about extensions. 493</p> 494 495<p class="backtotop"><a href="#top">Back to top</a></p> 496 497</div> 498 499 <!-- API PAGE --> 500 <div class="apiPage" style="display: none; "> 501 <a name="apiReference"></a> 502 <h2>API reference: chrome.apiname </h2> 503 504 <!-- PROPERTIES --> 505 <div class="apiGroup"> 506 <a name="properties"></a> 507 <h3 id="properties">Properties</h3> 508 509 <div> 510 <a></a> 511 <h4>getLastError</h4> 512 <div class="summary"> 513 <!-- Note: intentionally longer 80 columns --> 514 <span>chrome.extension</span><span>lastError</span> 515 </div> 516 <div> 517 </div> 518 </div> 519 520 </div> <!-- /apiGroup --> 521 522 <!-- METHODS --> 523 <div id="methodsTemplate" class="apiGroup"> 524 <a></a> 525 <h3>Methods</h3> 526 527 <!-- iterates over all functions --> 528 <div class="apiItem"> 529 <a></a> <!-- method-anchor --> 530 <h4>method name</h4> 531 532 <div class="summary"><span>void</span> 533 <!-- Note: intentionally longer 80 columns --> 534 <span>chrome.module.methodName</span>(<span><span>, </span><span></span> 535 <var><span></span></var></span>)</div> 536 537 <div class="description"> 538 <p class="todo">Undocumented.</p> 539 <p> 540 A description from the json schema def of the function goes here. 541 </p> 542 543 <!-- PARAMETERS --> 544 <h4>Parameters</h4> 545 <dl> 546 <div> 547 <div> 548 </div> 549 </div> 550 </dl> 551 552 <!-- RETURNS --> 553 <h4>Returns</h4> 554 <dl> 555 <div> 556 <div> 557 </div> 558 </div> 559 </dl> 560 561 <!-- CALLBACK --> 562 <div> 563 <div> 564 <h4>Callback function</h4> 565 <p> 566 The callback <em>parameter</em> should specify a function 567 that looks like this: 568 </p> 569 <p> 570 If you specify the <em>callback</em> parameter, it should 571 specify a function that looks like this: 572 </p> 573 574 <!-- Note: intentionally longer 80 columns --> 575 <pre>function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span>;</pre> 576 <dl> 577 <div> 578 <div> 579 </div> 580 </div> 581 </dl> 582 </div> 583 </div> 584 585 <!-- MIN_VERSION --> 586 <p> 587 This function was added in version <b><span></span></b>. 588 If you require this function, the manifest key 589 <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a> 590 can ensure that your extension won't be run in an earlier browser version. 591 </p> 592 </div> <!-- /description --> 593 594 </div> <!-- /apiItem --> 595 596 </div> <!-- /apiGroup --> 597 598 <!-- EVENTS --> 599 <div id="eventsTemplate" class="apiGroup"> 600 <a></a> 601 <h3>Events</h3> 602 <!-- iterates over all events --> 603 <div class="apiItem"> 604 <a></a> 605 <h4>event name</h4> 606 607 <div class="summary"> 608 <!-- Note: intentionally longer 80 columns --> 609 <span class="subdued">chrome.bookmarks</span><span>onEvent</span><span class="subdued">.addListener</span>(function(<span>Type param1, Type param2</span>) <span class="subdued">{...}</span>); 610 </div> 611 612 <div class="description"> 613 <p class="todo">Undocumented.</p> 614 <p> 615 A description from the json schema def of the event goes here. 616 </p> 617 618 <!-- PARAMETERS --> 619 <div> 620 <h4>Parameters</h4> 621 <dl> 622 <div> 623 <div> 624 </div> 625 </div> 626 </dl> 627 </div> 628 </div> <!-- /decription --> 629 630 </div> <!-- /apiItem --> 631 632 </div> <!-- /apiGroup --> 633 634 <!-- TYPES --> 635 <div class="apiGroup"> 636 <a name="types"></a> 637 <h3 id="types">Types</h3> 638 639 <!-- iterates over all types --> 640 <div class="apiItem"> 641 <a></a> 642 <h4>type name</h4> 643 644 <div> 645 </div> 646 647 </div> <!-- /apiItem --> 648 649 </div> <!-- /apiGroup --> 650 651 </div> <!-- /apiPage --> 652 </div> <!-- /gc-pagecontent --> 653 </div> <!-- /g-section --> 654 </div> <!-- /codesiteContent --> 655 <div id="gc-footer" --=""> 656 <div class="text"> 657 <p> 658 Except as otherwise <a href="http://code.google.com/policies.html#restrictions">noted</a>, 659 the content of this page is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons 660 Attribution 3.0 License</a>, and code samples are licensed under the 661 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>. 662 </p> 663 <p> 664 ©2011 Google 665 </p> 666 667<!-- begin analytics --> 668<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script> 669<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script> 670 671<script type="text/javascript"> 672 // chrome doc tracking 673 try { 674 var engdocs = _gat._getTracker("YT-10763712-2"); 675 engdocs._trackPageview(); 676 } catch(err) {} 677 678 // code.google.com site-wide tracking 679 try { 680 _uacct="UA-18071-1"; 681 _uanchor=1; 682 _uff=0; 683 urchinTracker(); 684 } 685 catch(e) {/* urchinTracker not available. */} 686</script> 687<!-- end analytics --> 688 </div> 689 </div> <!-- /gc-footer --> 690 </div> <!-- /gc-container --> 691</body></html> 692