This tutorial walks you through creating a simple extension. To complete this tutorial, you must have Windows; Linux and Mac don't yet support extensions.
[PENDING: automate the TOC; add navigation links to other pages]
To develop extensions for Google Chrome, you need to set up your browser:
In this section, you'll write a toolstrip — an extension that puts a bit of UI into the toolbar at the bottom of the Google Chrome window.
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.",
"toolstrips": [
"my_toolstrip.html"
]
}
my_toolstrip.html,
and put this in it:
<div class="toolstrip-button"> <span>Hello, World!</span> </div>
--enable-extensions
and --load-extension flags.
For example, if your extension is at c:\myext,
your shortcut might look something like this:
chrome.exe --enable-extensions --load-extension="c:\myext"
Note: For details on changing shortcut properties, see Creating and Using Profiles.
You should see the UI for your extension at the bottom left of the browser, looking something like this:
![]() |
![]() |
![]() |
| default appearance | initial onhover appearance | final onhover appearance |
|---|
Your extension's button is automatically styled to look like it belongs in the browser. If you put the cursor over the button, the button gets a nice, rounded edge, just like the buttons in the bookmark bar. After a while, a tooltip comes up, identifying the extension.
[PENDING: troubleshooting info should go here. what are symptoms of common typos, including misnamed files? what are the symptoms if you don't have the dev channel?]
In this step, you'll make your extension do something besides just look good.
Inside your extension's folder,
create a text file called hello_world.html,
and add the following code to it:
CSS and JavaScript code for hello_world
Edit my_toolstrip.html, so that it has the following code:
<div class="toolstrip-button" onclick="window.open('hello_world.html')">
<span>Hello, World!</span>
</div>
hello_world.html. It should look something like this:
If you don't see that page, 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!
You can use the browser's built-in developer tools to view your extension's code, display debugging output, and debug your extension.
Edit my_toolstrip.html, so that it has the following code:
<script> function helloWorld() { var hwFile = 'hello_world.html'; console.log("in helloWorld()"); window.open(hwFile); } </script> <div class="toolstrip-button" onclick="helloWorld();"> <span>Hello, World!</span> </div>
The relocated code still has the same effect,
but now it has some debugging output,
thanks to the call to console.log().
window.open() statement
by clicking 5 in the left column:

console.log()
along with the line number,
and execution should stop just before
the call to window.open().
The Call Stack area at the right of the tools window shows that
the helloWorld() method was called by an anonymous function
that was called by onclick.
Anywhere in the Call Stack or console that you see a file and line number
(for example, "my_toolstrip.html:4"),
you can click that text to see the relevant line of code.
hwFile is a local variable
that has the value "hello_world.html".
window.open() returns,
the main browser window should open a new tab
that displays the contents of hello_world.html.You now know how to load and debug an extension!
[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. Suggest where to go next.]