- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / templates / articles / faq.html
1 <h1>Frequently Asked Questions</h1>
2
3
4 <!--  -->
5
6 <p>
7 If you don't find an answer to your question here,
8 try the
9 <a href="http://code.google.com/chrome/webstore/faq.html">Chrome Web Store FAQ</a>, the
10 <a href="http://stackoverflow.com/questions/tagged/google-chrome-extension">[google-chrome-extension] tag on Stack Overflow</a>, the
11 <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions">group</a>, or the
12 <a href="http://www.google.com/support/chrome_webstore/">store help</a>.
13 </p>
14
15 <div id="faq-TOC">
16   <h4 id="general">General</h4>
17   <ul>
18     <li><a href="#faq-gen-01">What are Google Chrome Extensions?</a></li>
19 {{^is_apps}}
20     <li><a href="#faq-dev-01">How can I set up Chrome for extension development?</a></li>
21 {{/is_apps}}
22     <li><a href="#faq-gen-02">What technologies are used to write extensions for Chrome?</a></li>
23     <li><a href="#faq-gen-03">Are extensions fetched from the web every time the browser is loaded?</a></li>
24     <li><a href="#faq-dev-14">How do I determine which version of Chrome is deployed to which channel?</a></li>
25   </ul>
26   <h4 id="capabilities">Capabilities</h4>
27   <ul>
28     <li><a href="#faq-dev-02">Can extensions make cross-domain Ajax requests?</a></li>
29     <li><a href="#faq-dev-03">Can extensions use 3rd party web services?</a></li>
30     <li><a href="#faq-dev-07">Can extensions encode/decode JSON data?</a></li>
31     <li><a href="#faq-dev-08">Can extensions store data locally?</a></li>
32     <li><a href="#faq-dev-04">Can extensions use OAuth?</a></li>
33     <li><a href="#faq-dev-06">Can extensions load DLLs?</a></li>
34     <li><a href="#faq-dev-05">Can extensions create UI outside of the rendered web page?</a></li>
35     <li><a href="#faq-interact-chrome">Can extensions listen to clicks on Chrome tabs and navigation buttons?</a>
36     <li><a href="#faq-dev-11">Can two extensions communicate with each other?</a></li>
37 {{^is_apps}}
38     <li><a href="#faq-dev-13">Can extensions use Google Analytics?</a></li>
39     <li><a href="#faq-dev-15">Can extensions modify chrome:// URLs?</a></li>
40 {{/is_apps}}
41     <li><a href="#faq-open-popups">Can extensions open browser/page action popups without user interaction?</a></li>
42     <li><a href="#faq-persist-popups">Can extensions keep popups open after the user clicks away from them?</a></li>
43     <li><a href="#faq-lifecycle-events">Can extensions be notified when they are installed/uninstalled?</a></li>
44   </ul>
45   <h4 id="development">Development</h4>
46   <ul>
47     <li><a href="#faq-building-ui">How do I build a UI for my extension?</a>
48     <li><a href="#faq-dev-09">How much data can I store in localStorage?</a></li>
49 {{^is_apps}}
50     <li><a href="#faq-dev-10">How do I create an options menu for my application?</a></li>
51 {{/is_apps}}
52     <li><a href="#faq-dev-12">What debugging tools are available to extension developers?</a></li>
53     <li><a href="#faq-dev-16">Why do wildcard matches not work for top level domains (TLDs)?</a></li>
54     <li><a href="#faq-management">Why does the management API not fire events when my extension is installed/uninstalled?</a></li>
55     <li><a href="#faq-firstrun">How can an extension determine whether it is running for the first time?</a></li>
56   </ul>
57   <h4 id="features">Features and bugs</h4>
58   <ul>
59     <li><a href="#faq-fea-01">I think I've found a bug! How do I make sure it gets fixed?</a></li>
60     <li><a href="#faq-fea-02">I have a feature request! How can I report it?</a></li>
61   </ul>
62 </div>
63
64 <h2 id="general2">General</h2>
65
66 <h3 id="faq-gen-01">What are Google Chrome Extensions?</h3>
67 <p>
68   Google Chrome Extensions are applications that run inside the
69   Chrome browser and provide additional functionality, integration with third
70   party websites or services, and customized browsing experiences.
71 </p>
72
73 {{^is_apps}}
74 <h3 id="faq-dev-01">How can I set up Chrome for extension development?</h3>
75 <p>
76   As long as you are using a version of Chrome that supports
77   extensions, you already have everything you need to start writing an
78   extension of your own.
79   You can start by turning on Developer mode.
80   </p>
81
82   <p>
83   Click the Chrome menu icon
84   <img src="{{static}}/images/hotdogmenu.png" height="29" width="29" alt=""
85     class="nomargin" />
86   and select <b>Extensions</b> from the <b>Tools</b> menu.
87   Ensure that the "Developer mode" checkbox in the top right-hand corner
88   is checked.
89   Now you can reload extensions,
90   load an unpacked directory of files as if it were a packaged extension,
91   and more. For a complete tutorial, see
92   <a href="/extensions/getstarted.html">Getting Started</a>.
93 </p>
94 {{/is_apps}}
95
96 <h3 id="faq-gen-02">What technologies are used to write extensions for Chrome?</h3>
97 <p>
98   Extensions are written using the same standard web
99   technologies that developers use to create websites. HTML is used as a
100   content markup language, CSS is used for styling, and JavaScript for
101   scripting. Because Chrome supports HTML5 and CSS3, developers can
102   use the latest open web technologies such as canvas and CSS animations in
103   their extensions. Extensions also have access to several
104   <a href="/extensions/api_other.html">JavaScript APIs</a>
105   that help perform functions like JSON encoding and interacting with the
106   browser.
107 </p>
108
109
110 <h3 id="faq-gen-03">Are extensions fetched from the web every time the browser is loaded?</h3>
111 <p>
112   Extensions are downloaded by the Chrome browser upon install, and
113   are subsequently run off of the local disk in order to speed up
114   performance. However, if a new version of the extension is pushed online,
115   it will be automatically downloaded in the background to any users who
116   have the extension installed. Extensions may also make requests for remote
117   content at any time, in order to interact with a web service or pull new
118   content from the web.
119 </p>
120
121 <h3 id="faq-dev-14">How do I determine which version of Chrome is deployed to which channel?</h3>
122 <p>
123   To determine which version of Chrome is currently available on each
124   of the different platforms, visit
125   <a href="http://omahaproxy.appspot.com">omahaproxy.appspot.com</a>.  On that
126   site you will see data in a format similar to:
127 </p>
128
129 <pre>cf,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
130 cf,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
131 cf,stable,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
132 linux,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
133 linux,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
134 linux,stable,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
135 mac,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
136 mac,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
137 mac,stable,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
138 win,canary,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
139 win,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
140 win,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
141 win,stable,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
142 cros,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
143 cros,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####</pre>
144
145 <p>
146   Each line represents information about a different platform and channel
147   combination. The
148   listed platforms are <code>cf</code> (Google Chrome Frame),
149   <code>linux</code>, <code>mac</code>, <code>win</code>, and
150   <code>cros</code> (Google Chrome OS).  The listed
151   channels are <code>canary</code>, <code>dev</code>, <code>beta</code>,
152   and <code>stable</code>.
153   The two four-part numbers after the channel represent the current and previous
154   versions of Chrome deployed to that platform-channel
155   combination.  The rest of the information is metadata about when the releases
156   were first pushed, as well as revision numbers associated with each build.
157 </p>
158
159
160 <h2 id="capabilities2">Capabilities</h2>
161
162 <h3 id="faq-dev-02">Can extensions make cross-domain Ajax requests?</h3>
163 <p>
164   Yes. Extensions can make cross-domain requests.  See
165   <a href="/extensions/xhr.html">this page</a>
166   for more information.
167 </p>
168
169 <h3 id="faq-dev-03">Can extensions use 3rd party web services?</h3>
170 <p>
171   Yes. Extensions are capable of making cross-domain Ajax
172   requests, so they can call remote APIs directly. APIs that provide data
173   in JSON format are particularly easy to use.
174 </p>
175
176 <h3 id="faq-dev-07">Can extensions encode/decode JSON data?</h3>
177 <p>
178   Yes, because V8 (Chrome's JavaScript engine) supports
179   JSON.stringify and JSON.parse natively, you may use these functions in your
180   extensions
181   <a href="http://json.org/js.html">as described here</a> without including
182   any additional JSON libraries in your code.
183 </p>
184
185 <h3 id="faq-dev-08">Can extensions store data locally?</h3>
186 <p>
187   Yes, extensions can use <a href="http://dev.w3.org/html5/webstorage/">localStorage</a>
188   to store string data permanently. Using Chrome's built-in JSON
189   functions, you can store complex data structures in localStorage.  For
190   extensions that need to execute SQL queries on their stored data,
191   Chrome implements
192   <a href="http://dev.w3.org/html5/webdatabase/">client side SQL databases</a>,
193   which may be used as well.
194 </p>
195
196 <h3 id="faq-dev-04">Can extensions use OAuth?</h3>
197 <p>
198   Yes, there are extensions that use OAuth to access remote data
199   APIs. Most developers find it convenient to use a
200   <a href="http://unitedheroes.net/OAuthSimple/js/OAuthSimple.js">JavaScript OAuth library</a>
201   in order to simplify the process of signing OAuth requests.
202 </p>
203
204 <h3 id="faq-dev-06">Can extensions load DLLs?</h3>
205 <p>
206   Yes, using the <a href="npapi.html">NPAPI interface</a>.
207   Because of the possibility for abuse, though, we will review your extension
208   before hosting it in the Chrome Web Store.
209 </p>
210
211 <h3 id="faq-dev-05">Can extensions create UI outside of the rendered web page?</h3>
212 <p>
213   Yes, your extension may add buttons to the Chrome browser's user interface.
214   See <a href="browserAction.html">browser actions</a> and
215   <a href="pageAction.html">page actions</a> for more information.
216 </p>
217 <p>
218   An extension may also create popup notifications, which exist outside of the
219   browser window.  See the <a href="desktop_notifications.html">desktop
220     notifications</a> documentation for more details.
221 </p>
222
223 <h3 id="faq-interact-chrome">Can extensions listen to clicks on Chrome tabs and
224   navigation buttons?</h3>
225 <p>
226   No.  Extensions are limited to listening to the events described in the <a
227     href="api_index.html">API documentation</a>.
228 </p>
229
230 <h3 id="faq-dev-11">Can two extensions communicate with each other?</h3>
231 <p>
232   Yes, extensions may pass messages to other extensions. See the
233   <a href="messaging.html#external">message passing documentation</a>
234   for more information.
235 </p>
236
237 {{^is_apps}}
238 <h3 id="faq-dev-13">Can extensions use Google Analytics?</h3>
239 <p>
240   Yes, since extensions are built just like websites, they can use
241   <a href="http://www.google.com/analytics/">Google Analytics</a> to track
242   usage.  However, you must modify the tracking code to pull
243   an HTTPS version of the Google Analytics library.  See
244   <a href="tut_analytics.html">this tutorial</a> for more information on doing
245   this.
246 </p>
247 {{/is_apps}}
248
249 {{^is_apps}}
250 <h3 id="faq-dev-15">Can extensions modify chrome:// URLs?</h3>
251 <p>
252   No. The extensions APIs have been designed to minimize backwards
253   compatibility issues that can arise when new versions of the browser are
254   pushed. Allowing content scripts on <code>chrome://</code>
255   URLs would mean that developers would begin to rely on the DOM, CSS, and
256   JavaScript of these pages to stay the same.  In the best case, these pages
257   could not be updated as quickly as they are being updated right now.
258   In the worst case, it could mean that an update to one
259   of these pages could cause an extension to break, causing key parts of the
260   browser to stop working for users of that extension.
261 </p>
262
263 <p>
264   The reason that <a href="override.html">replacing the content</a>
265   hosted at these URLs entirely is
266   allowed is because it forces an extension developer to implement all of the
267   functionality they want without depending on the browser's internal implementation
268   to stay the same.
269 </p>
270 {{/is_apps}}
271
272 <h3 id="faq-open-popups">Can extensions open browser/page action popups without
273   user interaction?</h3>
274 <p>
275   No, popups can only be opened if the user clicks on the corresponding page or
276   browser action.  An extension cannot open its popup programatically.
277 </p>
278
279 <h3 id="faq-persist-popups">Can extensions keep popups open after the user
280   clicks away from them?</h3>
281 <p>
282   No, popups automatically close when the user focuses on some portion of the
283   browser outside of the popup.  There is no way to keep the popup open after
284   the user has clicked away.
285 </p>
286
287 <h3 id="faq-lifecycle-events">Can extensions be notified when they are
288   installed/uninstalled?</h3>
289 <p>
290   You can listen to the
291   $ref:runtime.onInstalled
292   event to be notified when your extension is installed or updated, or when
293   Chrome itself is updated. There is no corresponding event for when your
294   extension is uninstalled.
295 </p>
296
297
298 <h2 id="development2">Development</h2>
299
300
301 <h3 id="faq-building-ui">How do I build a UI for my extension?</h3>
302 <p>
303   Extensions use HTML and CSS to define their user interfaces, so you can use
304   standard form controls to build your UI, or style the interface with CSS,
305   as you would a web page.  Additionally, extensions can add
306   <a href="#faq-dev-05">some limited UI elements to Chrome itself.</a>
307 </p>
308
309 <h3 id="faq-dev-09">How much data can I store in localStorage?</h3>
310 <p>
311   Extensions can store up to 5MB of data in localStorage.
312 </p>
313
314 {{^is_apps}}
315 <h3 id="faq-dev-10">How do I create an options menu for my application?</h3>
316 <p>
317   You can let users set options for your extension by creating an
318   <a href="/extensions/options.html">options page</a>,
319   which is a simple HTML page that will be loaded when a user clicks the
320   "options" button for your extension. This page can read and write settings
321   to localStorage, or even send options to a web server so that they can be
322   persisted across browsers.
323 </p>
324 {{/is_apps}}
325
326 <h3 id="faq-dev-12">What debugging tools are available to extension developers?</h3>
327 <p>
328   Chrome's built-in developer tools can be used to debug extensions
329   as well as web pages. See this
330   <a href="/extensions/tut_debugging.html ">tutorial on debugging extensions</a>
331   for more information.
332 </p>
333
334 <h3 id="faq-dev-16">Why do wildcard matches not work for top level domains
335   (TLDs)?</h3>
336 <p>
337   You cannot use wildcard match patterns like <code>http://google.*/*</code>
338   to match TLDs (like <code>http://google.es</code> and
339   <code>http://google.fr</code>) due to the
340   complexity of actually restricting such a match to only the desired domains.
341 </p>
342 <p>
343   For the example of <code>http://google.*/*</code>, the Google domains would
344   be matched, but so would <code>http://google.someotherdomain.com</code>.
345   Additionally, many sites do not own all of the TLDs for their
346   domain.  For an example, assume you want to use
347   <code>http://example.*/*</code> to match <code>http://example.com</code> and
348   <code>http://example.es</code>, but <code>http://example.net</code> is a
349   hostile site.  If your extension has a bug, the hostile site could potentially
350   attack your extension in order to get access to your extension's increased
351   privileges.
352 </p>
353 <p>
354   You should explicitly enumerate the TLDs that you wish to run
355   your extension on.
356 </p>
357
358 <h3 id="faq-management">Why does the management API not fire events when my
359   extension is installed/uninstalled?</h3>
360 <p>
361   The <a href="management.html">management API</a> was intended to help create
362   new tab page replacement extensions.  It was not intended to fire
363   install/uninstall events for the current extension.
364 </p>
365
366 <h3 id="faq-firstrun">How can an extension determine whether it is running for
367   the first time?</h3>
368 <p>
369   You can listen to the
370   $ref:runtime.onInstalled
371   event. See <a href="#faq-lifecycle-events">this FAQ entry</a>.
372 </p>
373
374 <h2 id="features2">Features and bugs</h2>
375
376
377 <h3 id="faq-fea-01">I think I've found a bug! How do I make sure it gets
378   fixed?</h3>
379 <p>
380   While developing an extension, you may find behavior that does not
381   match the extensions documentation and may be the result of a bug in
382   Chrome.  The best thing to do is to make sure an appropriate issue
383   report is filed, and the Chromium team has enough information to reproduce
384   the behavior.
385 </p>
386
387 <p>The steps you should follow to ensure this are:</p>
388
389 <ol>
390   <li>
391     Come up with a <em>minimal</em> test extension that demonstrates the issue
392     you wish to report.  This extension should have as little code as possible
393     to demonstrate the bug&mdash;generally this should be 100 lines of
394     code or less.  Many times, developers find that they cannot reproduce their
395     issues this way, which is a good indicator that the bug is in their own
396     code.
397   </li>
398   <li>
399     Search the issue tracker at
400     <a href="http://crbug.com">http://crbug.com</a> to see whether
401     someone has reported a similar issue.  Most issues related to
402     extensions are filed under <strong>Cr=Platform-Extensions</strong>, so to
403     look for an extension bug related to the
404     chrome.tabs.executeScript function (for example), search for
405     "<code>Cr=Platform-Extensions Type=Bug chrome.tabs.executeScript</code>",
406     which will give you
407     <a href="https://code.google.com/p/chromium/issues/list?can=2&q=Cr%3DPlatform-Extensions+Type%3DBug+chrome.tabs.executeScript&colspec=ID+Pri+M+Iteration+ReleaseBlock+Cr+Status+Owner+Summary+Modified&x=m&y=releaseblock&cells=tiles">
408     this list of results</a>.
409   </li>
410   <li>
411     If you find a bug that describes your issue, click the star icon to be
412     notified when the bug receives an update.  <em>Do not respond to the
413     bug to say "me too" or ask "when will this be fixed?"</em>; such updates
414     can cause hundreds of emails to be sent.  Add a comment only if you have
415     information (such as a better test case or a suggested fix) that is likely
416     to be helpful.
417   </li>
418   <li>
419     If you found no appropriate bug to star, file a new issue report at
420     <a href="http://crbug.com/new">http://crbug.com/new</a>.  Be as explicit
421     as possible when filling out this form: choose a descriptive title,
422     explain the steps to reproduce the bug, and describe the expected and
423     actual behavior.  Attach your test example to the report and add
424     screenshots if appropriate.  The easier your report makes it for others
425     to reproduce your issue, the greater chance that your bug will be fixed
426     promptly.
427   </li>
428   <li>
429     Wait for the bug to be updated.  Most new bugs are triaged within a week,
430     although it can sometimes take longer for an update.  <em>Do not reply
431     to the bug to ask when the issue will be fixed.</em>  If your bug has not
432     been modified after two weeks, please post a message to the
433     <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions/topics">
434     discussion group</a> with a link back to your bug.
435   </li>
436   <li>
437     If you originally reported your bug on the discussion group and were
438     directed to this FAQ entry, reply to your original thread with a link
439     to the bug you starred or reported.  This will make it easier for others
440     experiencing the same issue to find the correct bug.
441   </li>
442 </ol>
443
444 <h3 id="faq-fea-02">I have a feature request! How can I report it?</h3>
445
446 <p>If you identify a feature (especially if it's related to an experimental
447   API) that could be added to improve the extension development experience,
448   make sure an appropriate request is filed in the issue tracker.</p>
449
450 <p>The steps you should follow to ensure this are:</p>
451
452 <ol>
453   <li>
454     Search the issue tracker at
455     <a href="http://crbug.com">http://crbug.com</a> to see whether
456     someone has requested a similar feature.  Most requests related to
457     extensions are filed under <strong>Cr=Platform-Extensions</strong>, so to
458     look for an extension feature request related to keyboard shortcuts
459     (for example), search
460     for "<code>Cr=Platform-Extensions Type=Feature shortcuts</code>",
461     which will give you
462     <a href="https://code.google.com/p/chromium/issues/list?can=2&q=Cr%3DPlatform-Extensions+Type%3DFeature+shortcuts&colspec=ID+Pri+M+Iteration+ReleaseBlock+Cr+Status+Owner+Summary+Modified&x=m&y=releaseblock&cells=tiles">
463     this list of results</a>.
464   </li>
465   <li>
466     If you find a ticket that matches your request, click the star icon to be
467     notified when the bug receives an update.  <em>Do not respond to the
468     bug to say "me too" or ask "when will this be implemented?"</em>; such
469     updates can cause hundreds of emails to be sent.
470   </li>
471   <li>
472     If you found no appropriate ticket to star, file a new request at
473     <a href="http://crbug.com/new">http://crbug.com/new</a>.  Be as detailed
474     as possible when filling out this form: choose a descriptive title
475     and explain exactly what feature you would like and how you plan to use it.
476   </li>
477   <li>
478     Wait for the ticket to be updated.  Most new requests are triaged within a
479     week, although it can sometimes take longer for an update.  <em>Do not reply
480     to the ticket to ask when the feature will be added.</em>  If your
481     ticket has not been modified after two weeks, please post a message to the
482     <a href="http://groups.google.com/a/chromium.org/group/chromium-extensions/topics">
483     discussion group</a> with a link back to your request.
484   </li>
485   <li>
486     If you originally reported your request on the discussion group and were
487     directed to this FAQ entry, reply to your original thread with a link
488     to the ticket you starred or opened.  This will make it easier for others
489     with the same request to find the correct ticket.
490   </li>
491 </ol>