The Chromium Projects

Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution 2.5 license, and examples are licensed under the BSD License.

The Chromium OS designs and code are preliminary. Expect them to evolve.
For Developers‎ > ‎Design Documents‎ > ‎Extensions‎ > ‎

Chrome Extension HOWTO

This page is obsolete. Please see the new version at:

http://code.google.com/chrome/extensions/getstarted.html


Getting Started

This tutorial will walk you through creating a simple extension that adds a button to a toolbar along the bottom of the browser window:

 

First of all, you will need to be using either the developer channel of Chromium or else a recent trunk build. Once you're using one of those, follow these instructions to create and add a basic extension.
  1. Create a folder somewhere on your computer to contain your work. For this discussion, we'll assume the folder is located at c:\myextension, but it can be anywhere.

  2. Inside this folder, create a text file called manifest.json and put this in it:

    {

      "name": "My First Extension",
      "version": "1.0",

      "description": "The first extension that I made.",
      "toolstrips": [
        "my_toolstrip.html"
      ]
    }


  3. Add a text file to the folder called my_toolstrip.html, and put the following code in it:

    <div class="toolstrip-button">
      <span>Hello, World!</span>
    </div>

  4. Find your chrome shortcut (for example, right-click the Chrome icon on your desktop and choose Properties) and add the --load-extension flag to it:

    chrome.exe --load-extension="c:\myextension"


  5. Restart Chrome. You should see your button in a new toolbar along the bottom of the browser window.

  6. Perhaps you would like it better if the button did something? Ok, create a new text file in the same place called hello_world.html, and put this code in it.

  7. Now change the code in my_toolstrip.html so that it looks like this:

    <div class="toolstrip-button" onclick="window.open('hello_world.html')">
      <span>Hello, World!</span>
    </div>

  8. Restart Chrome and click the button.

  9. Do a little dance, you earned it!

Notes

  • --enable-extensions is only needed while the extensions system is in development and will be removed.
  • We will eventually have better UI for arranging these.

Ok, Now What?