Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the BSD License.
©2009 Google
This tutorial walks you through creating a simple extension. You'll add an icon to Google Chrome that, when clicked, displays an automatically generated page. The icon and page will look something like this:
To develop extensions for Google Chrome, you need to subscribe to the Dev or Beta channel of Google Chrome for Windows. Extensions aren't yet available in the stable channel.
Note: This tutorial requires Windows. You can try it on Linux and OS X, and it might work, but the extensions support is less stable on those platforms. We're working hard to bring them up to speed.
In this section, you'll write an extension that adds a browser action to the toolbar of Google Chrome.
c:\myext
,
but it can be anywhere.
manifest.json
,
and put this in it:
{ "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "browser_action": { "default_icon": "icon.png" }, "permissions": [ "http://api.flickr.com/" ] }
Download icon.png |
c:\myext
, for example)
and click OK.
If your extension is valid, its icon appears next to the address bar, and information about the extension appears in the extensions page, as the following screenshot shows.
In this step, you'll make your extension do something besides just look good.
Edit manifest.json
to add the following line:
... "browser_action": { "default_icon": "icon.png", "popup": "popup.html" }, ...
Inside your extension's folder,
create a text file called popup.html
,
and add the following code to it:
CSS and JavaScript code for hello_world
popup.html
. It should look something like this:
If you don't see the popup, try the instructions again, following them exactly. Don't try loading an HTML file that isn't in the extension's folder — it won't work!
[PENDING: Summarize what we did, what it means, what else we would've done if this were a real extension (e.g. package it), and where to find more information.]
Here are some suggestions for what to do next: