Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: chrome/common/extensions/docs/server2/templates/articles/getstarted.html

Issue 10832042: Extensions Docs Server: Doc conversion script (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: everything but svn stuff Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <h1>Tutorial: Getting Started (Hello, World!)</h1>
2
3
4 <p>
5 This tutorial walks you through creating a simple extension. You'll add an
6 icon to Google Chrome that, when clicked, displays an automatically generated
7 page. The icon and page will look something like this:
8 </p>
9
10 <img src="{{static}}/images/hello-world-small.png"
11 width="300"
12 height="221"
13 alt="a window with a grid of images related to 'Hello World'">
14
15 <p>
16 You can develop extensions using any release of Google Chrome, on Windows,
17 Mac, or Linux. Extensions you develop on one platform should run without
18 change on every platform Chrome supports.
19 </p>
20
21 <h2 id="load">Create and load an extension</h2>
22
23 <p>
24 The extension we'll walk through creating here is a
25 <a href="browserAction.html">Browser Action</a>, which adds a button to
26 Chrome's toolbar whose behavior you can control.
27 </p>
28
29 <ol>
30 <li>
31 Create a folder somewhere on your computer to contain your extension's code.
32 </li>
33 <li>
34 <p>
35 Inside your extension's folder, create a text file called
36 <strong><code>manifest.json</code></strong>, and fill it with the
37 following code:
38 </p>
39 <pre>{
40 "name": "My First Extension",
41 "version": "1.0",
42 "manifest_version": 2,
43 "description": "The first extension that I made.",
44 "browser_action": {
45 "default_icon": "icon.png"
46 },
47 "permissions": [
48 "http://api.flickr.com/"
49 ]
50 }</pre>
51 </li>
52 <li>
53 <p>Copy this icon to the same folder:</p>
54 <div style="width: 150px; text-align: center;">
55 <a href='../examples/tutorials/getstarted/icon.png'
56 download='icon'>
57 <img src='../examples/tutorials/getstarted/icon.png'
58 width='19'
59 height='19'
60 alt=''
61 style='display: block; margin: 0.25em auto;'>
62 Download icon.png
63 </a>
64 </div>
65 </li>
66 <li id="load-ext">
67 <p>Load the extension.</p>
68 <ol type="a">
69 <li style="margin-top:0" />
70 Bring up the extensions management page
71 by clicking the wrench icon
72 <img src="{{static}}/images/toolsmenu.gif" width="29" height="29" alt=""
73 style="margin-top:0" />
74 and choosing <b>Tools > Extensions</b>.
75 </li>
76
77 <li>
78 If <b>Developer mode</b> has a + by it,
79 click the + to add developer information to the page.
80 The + changes to a -,
81 and more buttons and information appear.
82 </li>
83
84 <li>
85 Click the <b>Load unpacked extension</b> button.
86 A file dialog appears.
87 </li>
88
89 <li>
90 In the file dialog,
91 navigate to your extension's folder
92 and click <b>OK</b>.
93 </li>
94 </ol> </li>
95 </ol>
96
97 <p>
98 If your extension is valid,
99 its icon appears next to the address bar,
100 and information about the extension
101 appears in the extensions page,
102 as the following screenshot shows.
103 </p>
104
105 <p>
106 <a href="{{static}}/images/load_after.png"><img
107 src="{{static}}/images/load_after_small.png"
108 width="300" height="132" /></a>
109 </p>
110
111 <h2 id="code">Add code to the extension</h2>
112 <p>
113 In this step, you'll make your extension <em>do</em> something besides just
114 look good.
115 </p>
116
117 <ol>
118 <li>
119 <p>Edit <code>manifest.json</code> to add the following line:</p>
120 <pre>...
121 "browser_action": {
122 "default_icon": "icon.png"<b>,
123 "default_popup": "popup.html"</b>
124 },
125 ...</pre>
126
127 <p>
128 Inside your extension's folder, create two text files called
129 <strong><code>popup.html</code></strong> and
130 <strong><code>popup.js</code></strong>. Add the following code to
131 these files:
132 </p>
133 <blockquote>
134 <a href="../examples/tutorials/getstarted/popup.html"
135 target="_blank">HTML code (popup.html)</a> and
136 <a href="../examples/tutorials/getstarted/popup.js"
137 target="_blank">JavaScript code (popup.js)</a> for hello_world</a> </blockqu ote>
138 </li>
139 <li>
140 Return to the extensions management page,
141 and click the <b>Reload</b> button
142 to load the new version of the extension.</li>
143 <li>Click the extension's icon.
144 A popup should appear that displays the contents of
145 <code>popup.html</code>. </li>
146 </ol>
147 <p> It should look something like this:</p>
148
149 <img src="{{static}}/images/hello-world.png"
150 width="500" height="369"
151 alt="a popup with a grid of images related to HELLO WORLD" />
152
153 <p> If you don't see the popup,
154 try the instructions again,
155 following them exactly.
156 Don't try loading an HTML file that isn't in the extension's folder &mdash;
157 it won't work! </p>
158
159 <h2 id="summary">Now what?</h2>
160
161
162
163 <p>
164 Here are some suggestions for what to read next:
165 </p>
166
167 <ul>
168 <li>
169 The <a href="overview.html">Overview</a>,
170 which has important conceptual and practical information
171 </li>
172 <li>
173 The
174 <a href="tut_debugging.html">debugging tutorial</a>,
175 which starts where this tutorial leaves off
176 </li>
177 <li>
178 The <a href="hosting.html">hosting</a> page,
179 which tells you about options for distributing your extension
180 </li>
181 </ul>
182
183 <p>
184 If you don't feel like reading, try these:
185 </p>
186 <ul>
187 <li>
188 Keep up to date with the latest news:
189 <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions/s ubscribe">subscribe to chromium-extensions</a>
190 </li>
191 <li>
192 Ask a question tagged [google-chrome-extension] on
193 <a href="http://stackoverflow.com/questions/tagged/google-chrome-extension"> Stack Overflow</a>
194 </li>
195 <li>
196 Look at some
197 <a href="samples.html">sample extensions</a>
198 </li>
199 <li>
200 Watch some
201 <a href="http://www.youtube.com/view_play_list?p=CA101D6A85FE9D4B">videos</a >, such as
202 <a href="http://www.youtube.com/watch?v=e3McMaHvlBY&feature=PlayList&p=CA101 D6A85FE9D4B&index=3">How to build an extension</a>
203 </li>
204 </ul>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698