| OLD | NEW |
| 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: | 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 | 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 | 3 across api docs and should be edited only with knowledge of the |
| 4 templating mechanism. | 4 templating mechanism. |
| 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | 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 | 6 browser, it will be re-generated from the template, json schema and |
| 7 authored overview content. | 7 authored overview content. |
| 8 4) The <body>.innerHTML is also generated by an offline step so that this | 8 4) The <body>.innerHTML is also generated by an offline step so that this |
| 9 page may easily be indexed by search engines. | 9 page may easily be indexed by search engines. |
| 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 or <a href="pageAction.html">page actions</a>. | 401 or <a href="pageAction.html">page actions</a>. |
| 402 Each extension can have at most one browser action or page action. | 402 Each extension can have at most one browser action or page action. |
| 403 Choose a <b>browser action</b> when the extension is relevant to most pages. | 403 Choose a <b>browser action</b> when the extension is relevant to most pages. |
| 404 Choose a <b>page action</b> when the extension's icon | 404 Choose a <b>page action</b> when the extension's icon |
| 405 should appear or disappear, | 405 should appear or disappear, |
| 406 depending on the page. | 406 depending on the page. |
| 407 </p> | 407 </p> |
| 408 | 408 |
| 409 <table class="columns"> | 409 <table class="columns"> |
| 410 <tbody><tr> | 410 <tbody><tr> |
| 411 <td> | 411 <td width="33%"> |
| 412 <img src="images/index/gmail.png" width="150" height="79" alt="screenshot"> | 412 <img src="images/overview/browser-action.png" width="147" height="100" alt="
screenshot"> |
| 413 </td> |
| 414 <td width="33%"> |
| 415 <img src="images/overview/page-action.png" width="147" height="100" alt="scr
eenshot"> |
| 413 </td> | 416 </td> |
| 414 <td> | 417 <td> |
| 415 <img src="images/index/news.png" width="150" height="79" alt="screenshot"> | 418 <img src="images/overview/browser-action-with-popup.png" width="147" height=
"100" alt="screenshot"> |
| 416 </td> | |
| 417 <td> | |
| 418 <img src="images/index/rss.png" width="150" height="79" alt="screenshot"> | |
| 419 </td> | 419 </td> |
| 420 </tr> | 420 </tr> |
| 421 | 421 |
| 422 <tr> | 422 <tr> |
| 423 <td> | 423 <td> |
| 424 This <a href="samples.html#gmail">mail extension</a> | 424 This <a href="samples.html#gmail">mail extension</a> |
| 425 uses a <em>browser action</em> | 425 uses a <em>browser action</em> |
| 426 (icon in the toolbar). | 426 (icon in the toolbar). |
| 427 </td> | 427 </td> |
| 428 <td> | 428 <td> |
| 429 This <a href="samples.html#news">news reader extension</a> | |
| 430 features a browser action that, | |
| 431 when clicked, | |
| 432 shows a <em>popup</em>. | |
| 433 </td> | |
| 434 <td> | |
| 435 This <a href="samples.html#mappy">map extension</a> | 429 This <a href="samples.html#mappy">map extension</a> |
| 436 uses a <em>page action</em> | 430 uses a <em>page action</em> |
| 437 (icon in the address bar) | 431 (icon in the address bar) |
| 438 and <em>content script</em> | 432 and <em>content script</em> |
| 439 (code injected into a web page). | 433 (code injected into a web page). |
| 440 </td> | 434 </td> |
| 435 <td> |
| 436 This <a href="samples.html#news">news extension</a> |
| 437 features a browser action that, |
| 438 when clicked, |
| 439 shows a <em>popup</em>. |
| 440 </td> |
| 441 </tr> | 441 </tr> |
| 442 </tbody></table> | 442 </tbody></table> |
| 443 | 443 |
| 444 <p> | 444 <p> |
| 445 Extensions (and packaged apps) can also present a UI in other ways, | 445 Extensions (and packaged apps) can also present a UI in other ways, |
| 446 such as adding to the Chrome context menu, | 446 such as adding to the Chrome context menu, |
| 447 providing an options page, | 447 providing an options page, |
| 448 or using a content script that changes how pages look. | 448 or using a content script that changes how pages look. |
| 449 See the <a href="devguide.html">Developer's Guide</a> | 449 See the <a href="devguide.html">Developer's Guide</a> |
| 450 for a complete list of extension features, | 450 for a complete list of extension features, |
| 451 with links to implementation details | 451 with links to implementation details |
| 452 for each one. | 452 for each one. |
| 453 </p> | 453 </p> |
| 454 | 454 |
| 455 | 455 |
| 456 <h3 id="packagedapp-ui">Packaged app UIs</h3> | 456 <h3 id="packagedapp-ui">Packaged app UIs</h3> |
| 457 | 457 |
| 458 <p> | 458 <p> |
| 459 A packaged app usually presents its main functionality using | 459 A packaged app usually presents its main functionality using |
| 460 an HTML page that's bundled into the app. | 460 an HTML page that's bundled into the app. |
| 461 For example, the following packaged app | 461 For example, the following packaged app |
| 462 displays a Flash file within an HTML page. | 462 displays a Flash file within an HTML page. |
| 463 </p> | 463 </p> |
| 464 | 464 |
| 465 <img src="images/index/flashapp.png" width="372" height="300" alt="screenshot"> | 465 <img src="images/overview/flash-app.png" width="372" height="300" alt="screensho
t"> |
| 466 | 466 |
| 467 <p> | 467 <p> |
| 468 For more information, | 468 For more information, |
| 469 see <a href="apps.html">Packaged Apps</a>. | 469 see <a href="apps.html">Packaged Apps</a>. |
| 470 </p> | 470 </p> |
| 471 | 471 |
| 472 <h2 id="files">Files</h2> | 472 <h2 id="files">Files</h2> |
| 473 <p> | 473 <p> |
| 474 Each extension has the following files: | 474 Each extension has the following files: |
| 475 <!-- PENDING: This could use a picture --> | 475 <!-- PENDING: This could use a picture --> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 | 567 |
| 568 <h2 id="arch">Architecture</h2> | 568 <h2 id="arch">Architecture</h2> |
| 569 | 569 |
| 570 <p> | 570 <p> |
| 571 Most extensions have a | 571 Most extensions have a |
| 572 <a href="background_pages.html">background page</a>, | 572 <a href="background_pages.html">background page</a>, |
| 573 an invisible page | 573 an invisible page |
| 574 that holds the main logic of the extension. | 574 that holds the main logic of the extension. |
| 575 </p> | 575 </p> |
| 576 | 576 |
| 577 <img src="images/arch-1.gif" width="232" height="168" alt="Two windows and a box
representing a background page (background.html). One window has a yellow icon;
the other has both a yellow icon and a blue icon. The yellow icons are connecte
d to the background page."> | 577 <img src="images/overview/arch-1.gif" width="232" height="168" alt="Two windows
and a box representing a background page (background.html). One window has a yel
low icon; the other has both a yellow icon and a blue icon. The yellow icons are
connected to the background page."> |
| 578 | 578 |
| 579 <p> | 579 <p> |
| 580 The preceding figure shows a browser | 580 The preceding figure shows a browser |
| 581 that has at least two extensions installed: | 581 that has at least two extensions installed: |
| 582 a browser action (yellow icon) | 582 a browser action (yellow icon) |
| 583 and a page action (blue icon). | 583 and a page action (blue icon). |
| 584 The browser action's background page, | 584 The browser action's background page, |
| 585 which is defined by an HTML file | 585 which is defined by an HTML file |
| 586 (<code>background.html</code>), | 586 (<code>background.html</code>), |
| 587 has JavaScript code that controls | 587 has JavaScript code that controls |
| (...skipping 25 matching lines...) Expand all Loading... |
| 613 of a browser action's popup. | 613 of a browser action's popup. |
| 614 The popup's contents are a web page | 614 The popup's contents are a web page |
| 615 defined by an HTML file | 615 defined by an HTML file |
| 616 (<code>popup.html</code>). | 616 (<code>popup.html</code>). |
| 617 The popup doesn't need to duplicate code | 617 The popup doesn't need to duplicate code |
| 618 that's in the background page | 618 that's in the background page |
| 619 (<code>background.html</code>) | 619 (<code>background.html</code>) |
| 620 because the popup can invoke functions on the background page. | 620 because the popup can invoke functions on the background page. |
| 621 </p> | 621 </p> |
| 622 | 622 |
| 623 <img src="images/arch-2.gif" width="256" height="168" alt="A browser window cont
aining a browser action that's displaying a popup. The popup's HTML file (popup.
html) can communicate with the extension's background page (background.html)."> | 623 <img src="images/overview/arch-2.gif" width="256" height="168" alt="A browser wi
ndow containing a browser action that's displaying a popup. The popup's HTML fil
e (popup.html) can communicate with the extension's background page (background.
html)."> |
| 624 | 624 |
| 625 <p> | 625 <p> |
| 626 See the <a href="browserAction.html">Browser Actions</a> page and | 626 See the <a href="browserAction.html">Browser Actions</a> page and |
| 627 the <a href="#pageComm">Communication between pages</a> section | 627 the <a href="#pageComm">Communication between pages</a> section |
| 628 for more details. | 628 for more details. |
| 629 </p> | 629 </p> |
| 630 | 630 |
| 631 | 631 |
| 632 <h3 id="contentScripts">Content scripts</h3> | 632 <h3 id="contentScripts">Content scripts</h3> |
| 633 | 633 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 654 <p> | 654 <p> |
| 655 Content scripts can read details of the web pages the browser visits, | 655 Content scripts can read details of the web pages the browser visits, |
| 656 and they can make changes to the pages. | 656 and they can make changes to the pages. |
| 657 In the following figure, | 657 In the following figure, |
| 658 the content script | 658 the content script |
| 659 can read and modify | 659 can read and modify |
| 660 the DOM for the displayed web page. | 660 the DOM for the displayed web page. |
| 661 It cannot, however, modify the DOM of its parent extension's background page. | 661 It cannot, however, modify the DOM of its parent extension's background page. |
| 662 </p> | 662 </p> |
| 663 | 663 |
| 664 <img src="images/arch-3.gif" width="238" height="169" alt="A browser window with
a browser action (controlled by background.html) and a content script (controll
ed by contentscript.js)."> | 664 <img src="images/overview/arch-3.gif" width="238" height="169" alt="A browser wi
ndow with a browser action (controlled by background.html) and a content script
(controlled by contentscript.js)."> |
| 665 | 665 |
| 666 <p> | 666 <p> |
| 667 Content scripts aren't completely cut off from their parent extensions. | 667 Content scripts aren't completely cut off from their parent extensions. |
| 668 A content script can exchange messages with its parent extension, | 668 A content script can exchange messages with its parent extension, |
| 669 as the arrows in the following figure show. | 669 as the arrows in the following figure show. |
| 670 For example, a content script might send a message | 670 For example, a content script might send a message |
| 671 whenever it finds an RSS feed in a browser page. | 671 whenever it finds an RSS feed in a browser page. |
| 672 Or a background page might send a message | 672 Or a background page might send a message |
| 673 asking a content script to change the appearance of its browser page. | 673 asking a content script to change the appearance of its browser page. |
| 674 </p> | 674 </p> |
| 675 | 675 |
| 676 <img src="images/arch-cs.gif" width="238" height="194" alt="Like the previous fi
gure, but showing more of the parent extension's files, as well as a communicati
on path between the content script and the parent extension."> | 676 <img src="images/overview/arch-cs.gif" width="238" height="194" alt="Like the pr
evious figure, but showing more of the parent extension's files, as well as a co
mmunication path between the content script and the parent extension."> |
| 677 | 677 |
| 678 <!-- [PENDING: Add overview of message passing.] --> | 678 <!-- [PENDING: Add overview of message passing.] --> |
| 679 | 679 |
| 680 <p> | 680 <p> |
| 681 For more information, | 681 For more information, |
| 682 see <a href="content_scripts.html">Content Scripts</a>. | 682 see <a href="content_scripts.html">Content Scripts</a>. |
| 683 </p> | 683 </p> |
| 684 | 684 |
| 685 | 685 |
| 686 <h2 id="pageComm">Communication between pages </h2> | 686 <h2 id="pageComm">Communication between pages </h2> |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 _uff=0; | 968 _uff=0; |
| 969 urchinTracker(); | 969 urchinTracker(); |
| 970 } | 970 } |
| 971 catch(e) {/* urchinTracker not available. */} | 971 catch(e) {/* urchinTracker not available. */} |
| 972 </script> | 972 </script> |
| 973 <!-- end analytics --> | 973 <!-- end analytics --> |
| 974 </div> | 974 </div> |
| 975 </div> <!-- /gc-footer --> | 975 </div> <!-- /gc-footer --> |
| 976 </div> <!-- /gc-container --> | 976 </div> <!-- /gc-container --> |
| 977 </body></html> | 977 </body></html> |
| OLD | NEW |