-
Notifications
You must be signed in to change notification settings - Fork 37
/
faq.html
782 lines (729 loc) · 37.9 KB
/
faq.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="stable/static/css/site.css" rel="stylesheet" type="text/css">
<link href="stable/static/css/print.css" rel="stylesheet" type="text/css" media="print">
<link href="stable/static/css/prettify.css" rel="stylesheet" type="text/css">
<link href="//www.google.com/images/icons/product/chrome-16.png" rel="icon" type="image/ico">
<title>Frequently Asked Questions - chrome插件中文开发文档(非官方)</title>
</head>
<body>
<a id="top"></a>
<div id="header">{Header content}</div>
<a id="gc-topnav-anchor"></a>
<div id="gc-topnav">
<h1>Google Chrome Extensions</h1>
<ul id="home" class="gc-topnav-tabs">
<li id="home_link">
<a href="index.html" title="Google Chrome Extensions home page"><div>Home</div></a>
</li>
<li id="docs_link">
<a href="docs.html" title="Official Google Chrome Extensions documentation"><div>Docs</div></a>
</li>
<li id="faq_link">
<a href="faq.html" title="Answers to frequently asked questions about Google Chrome Extensions"><div>FAQ</div></a>
</li>
<li id="samples_link">
<a href="samples.html" title="Sample Extensions (with source code)"><div>Samples</div></a>
</li>
<li id="group_link">
<a href="http://groups.google.com/a/chromium.org/group/chromium-extensions" title="Google Chrome Extensions developer forum"><div>Group</div></a>
</li>
<li id="so_link">
<a href="http://stackoverflow.com/questions/tagged/google-chrome-extension" title="[google-chrome-extension] tag on Stack Overflow"><div>Questions?</div></a>
</li>
</ul>
</div>
<div id="gc-container">
<div id="gc-sidebar">
<ul
class="level1 ">
<li class="level2">
<a href="getstarted.html" class="level2 ">Getting Started</a>
</li>
<li class="level2">
<a href="overview.html" class="level2 ">Overview</a>
</li>
<li class="level2">
<a href="whats_new.html" class="level2 ">What's New?</a>
</li>
<li class="level2">
<a href="devguide.html" class="level2 ">Developer's Guide</a>
<ul
class="level2 ">
<li class="level3">
<a class="button level3">
<span class="level3">Browser UI</span>
<div class="toggleIndicator level3"></div>
</a>
<ul toggleable
class="level3 hidden">
<li class="level4">
<a href="browserAction.html" class="level4 ">Browser Actions</a>
</li>
<li class="level4">
<a href="contextMenus.html" class="level4 ">Context Menus</a>
</li>
<li class="level4">
<a href="notifications.html" class="level4 ">Desktop Notifications</a>
</li>
<li class="level4">
<a href="omnibox.html" class="level4 ">Omnibox</a>
</li>
<li class="level4">
<a href="options.html" class="level4 ">Options Pages</a>
</li>
<li class="level4">
<a href="override.html" class="level4 ">Override Pages</a>
</li>
<li class="level4">
<a href="pageAction.html" class="level4 ">Page Actions</a>
</li>
</ul>
</li>
<li class="level3">
<a class="button level3">
<span class="level3">Browser Interaction</span>
<div class="toggleIndicator level3"></div>
</a>
<ul toggleable
class="level3 hidden">
<li class="level4">
<a href="bookmarks.html" class="level4 ">Bookmarks</a>
</li>
<li class="level4">
<a href="cookies.html" class="level4 ">Cookies</a>
</li>
<li class="level4">
<a href="devtools.html" class="level4 ">Developer Tools</a>
</li>
<li class="level4">
<a href="events.html" class="level4 ">Events</a>
</li>
<li class="level4">
<a href="history.html" class="level4 ">History</a>
</li>
<li class="level4">
<a href="management.html" class="level4 ">Management</a>
</li>
<li class="level4">
<a href="tabs.html" class="level4 ">Tabs</a>
</li>
<li class="level4">
<a href="windows.html" class="level4 ">Windows</a>
</li>
</ul>
</li>
<li class="level3">
<a class="button level3">
<span class="level3">Implementation</span>
<div class="toggleIndicator level3"></div>
</a>
<ul toggleable
class="level3 hidden">
<li class="level4">
<a href="a11y.html" class="level4 ">Accessibility</a>
</li>
<li class="level4">
<a href="event_pages.html" class="level4 ">Event Pages</a>
</li>
<li class="level4">
<a href="contentSecurityPolicy.html" class="level4 ">Content Security Policy</a>
</li>
<li class="level4">
<a href="content_scripts.html" class="level4 ">Content Scripts</a>
</li>
<li class="level4">
<a href="xhr.html" class="level4 ">Cross-Origin XHR</a>
</li>
<li class="level4">
<a href="i18n.html" class="level4 ">Internationalization</a>
</li>
<li class="level4">
<a href="messaging.html" class="level4 ">Message Passing</a>
</li>
<li class="level4">
<a href="permissions.html" class="level4 ">Optional Permissions</a>
</li>
<li class="level4">
<a href="npapi.html" class="level4 ">NPAPI Plugins</a>
</li>
</ul>
</li>
<li class="level3">
<a class="button level3">
<span class="level3">Finishing</span>
<div class="toggleIndicator level3"></div>
</a>
<ul toggleable
class="level3 hidden">
<li class="level4">
<a href="hosting.html" class="level4 ">Hosting</a>
</li>
<li class="level4">
<a href="external_extensions.html" class="level4 ">Other Deployment Options</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="level2">
<a href="tutorials.html" class="level2 ">Tutorials</a>
<ul
class="level2 ">
<li class="level3">
<a href="tut_migration_to_manifest_v2.html" class="level3 ">Manifest V2</a>
</li>
<li class="level3">
<a href="tut_debugging.html" class="level3 ">Debugging</a>
</li>
<li class="level3">
<a href="tut_analytics.html" class="level3 ">Google Analytics</a>
</li>
<li class="level3">
<a href="tut_oauth.html" class="level3 ">OAuth</a>
</li>
</ul>
</li>
<li class="level2">
<span class="level2">Reference</span>
<ul
class="level2 ">
<li class="level3">
<a class="button level3">
<span class="level3">Formats</span>
<div class="toggleIndicator level3"></div>
</a>
<ul toggleable
class="level3 hidden">
<li class="level4">
<a href="manifest.html" class="level4 ">Manifest Files</a>
</li>
<li class="level4">
<a href="match_patterns.html" class="level4 ">Match Patterns</a>
</li>
</ul>
</li>
<li class="level3">
<a href="permission_warnings.html" class="level3 ">Permission Warnings</a>
</li>
<li class="level3">
<a href="api_index.html" class="level3 ">chrome.* APIs</a>
</li>
<li class="level3">
<a href="api_other.html" class="level3 ">Other APIs</a>
</li>
</ul>
</li>
<li class="level2">
<span class="level2">More</span>
<ul
class="level2 ">
<li class="level3">
<a href="http://code.google.com/chrome/webstore/docs/index.html" class="level3 ">Chrome Web Store</a>
</li>
<li class="level3">
<a href="http://code.google.com/chrome/apps/docs/developers_guide.html" class="level3 ">Hosted Apps</a>
</li>
<li class="level3">
<a href="themes.html" class="level3 ">Themes</a>
</li>
</ul>
</li>
</ul>
</div>
<div id="gc-pagecontent">
<h1 class="page_title">Frequently Asked Questions</h1>
<div id="toc">
<h2>Contents</h2>
<ol>
<li>
<a href=#general2>General</a>
<ol>
<li><a href=#faq-gen-01>What are Google Chrome Extensions?</a></li><li><a href=#faq-dev-01>How can I set up Chrome for extension development?</a></li><li><a href=#faq-gen-02>What technologies are used to write extensions for Chrome?</a></li><li><a href=#faq-gen-03>Are extensions fetched from the web every time the browser is loaded?</a></li><li><a href=#faq-dev-14>How do I determine which version of Chrome is deployed to which channel?</a></li>
</ol>
</li>
<li>
<a href=#capabilities2>Capabilities</a>
<ol>
<li><a href=#faq-dev-02>Can extensions make cross-domain Ajax requests?</a></li><li><a href=#faq-dev-03>Can extensions use 3rd party web services?</a></li><li><a href=#faq-dev-07>Can extensions encode/decode JSON data?</a></li><li><a href=#faq-dev-08>Can extensions store data locally?</a></li><li><a href=#faq-dev-04>Can extensions use OAuth?</a></li><li><a href=#faq-dev-06>Can extensions load DLLs?</a></li><li><a href=#faq-dev-05>Can extensions create UI outside of the rendered web page?</a></li><li><a href=#faq-interact-chrome>Can extensions listen to clicks on Chrome tabs and navigation buttons?</a></li><li><a href=#faq-dev-11>Can two extensions communicate with each other?</a></li><li><a href=#faq-dev-13>Can extensions use Google Analytics?</a></li><li><a href=#faq-dev-15>Can extensions modify chrome:// URLs?</a></li><li><a href=#faq-open-popups>Can extensions open browser/page action popups without user interaction?</a></li><li><a href=#faq-persist-popups>Can extensions keep popups open after the user clicks away from them?</a></li><li><a href=#faq-lifecycle-events>Can extensions be notified when they are installed/uninstalled?</a></li>
</ol>
</li>
<li>
<a href=#development2>Development</a>
<ol>
<li><a href=#faq-building-ui>How do I build a UI for my extension?</a></li><li><a href=#faq-dev-09>How much data can I store in localStorage?</a></li><li><a href=#faq-dev-10>How do I create an options menu for my application?</a></li><li><a href=#faq-dev-12>What debugging tools are available to extension developers?</a></li><li><a href=#faq-dev-16>Why do wildcard matches not work for top level domains (TLDs)?</a></li><li><a href=#faq-management>Why does the management API not fire events when my extension is installed/uninstalled?</a></li><li><a href=#faq-firstrun>How can an extension determine whether it is running for the first time?</a></li>
</ol>
</li>
<li>
<a href=#features2>Features and bugs</a>
<ol>
<li><a href=#faq-fea-01>I think I've found a bug! How do I make sure it gets fixed?</a></li><li><a href=#faq-fea-02>I have a feature request! How can I report it?</a></li>
</ol>
</li>
</ol>
</div>
<!-- -->
<p>
If you don't find an answer to your question here,
try the
<a href="http://code.google.com/chrome/webstore/faq.html">Chrome Web Store FAQ</a>, the
<a href="http://stackoverflow.com/questions/tagged/google-chrome-extension">[google-chrome-extension] tag on Stack Overflow</a>, the
<a href="http://groups.google.com/a/chromium.org/group/chromium-extensions">group</a>, or the
<a href="http://www.google.com/support/chrome_webstore/">store help</a>.
</p>
<div id="faq-TOC">
<h4 id="general">General</h4>
<ul>
<li><a href="#faq-gen-01">What are Google Chrome Extensions?</a></li>
<li><a href="#faq-dev-01">How can I set up Chrome for extension development?</a></li>
<li><a href="#faq-gen-02">What technologies are used to write extensions for Chrome?</a></li>
<li><a href="#faq-gen-03">Are extensions fetched from the web every time the browser is loaded?</a></li>
<li><a href="#faq-dev-14">How do I determine which version of Chrome is deployed to which channel?</a></li>
</ul>
<h4 id="capabilities">Capabilities</h4>
<ul>
<li><a href="#faq-dev-02">Can extensions make cross-domain Ajax requests?</a></li>
<li><a href="#faq-dev-03">Can extensions use 3rd party web services?</a></li>
<li><a href="#faq-dev-07">Can extensions encode/decode JSON data?</a></li>
<li><a href="#faq-dev-08">Can extensions store data locally?</a></li>
<li><a href="#faq-dev-04">Can extensions use OAuth?</a></li>
<li><a href="#faq-dev-06">Can extensions load DLLs?</a></li>
<li><a href="#faq-dev-05">Can extensions create UI outside of the rendered web page?</a></li>
<li><a href="#faq-interact-chrome">Can extensions listen to clicks on Chrome tabs and navigation buttons?</a>
<li><a href="#faq-dev-11">Can two extensions communicate with each other?</a></li>
<li><a href="#faq-dev-13">Can extensions use Google Analytics?</a></li>
<li><a href="#faq-dev-15">Can extensions modify chrome:// URLs?</a></li>
<li><a href="#faq-open-popups">Can extensions open browser/page action popups without user interaction?</a></li>
<li><a href="#faq-persist-popups">Can extensions keep popups open after the user clicks away from them?</a></li>
<li><a href="#faq-lifecycle-events">Can extensions be notified when they are installed/uninstalled?</a></li>
</ul>
<h4 id="development">Development</h4>
<ul>
<li><a href="#faq-building-ui">How do I build a UI for my extension?</a>
<li><a href="#faq-dev-09">How much data can I store in localStorage?</a></li>
<li><a href="#faq-dev-10">How do I create an options menu for my application?</a></li>
<li><a href="#faq-dev-12">What debugging tools are available to extension developers?</a></li>
<li><a href="#faq-dev-16">Why do wildcard matches not work for top level domains (TLDs)?</a></li>
<li><a href="#faq-management">Why does the management API not fire events when my extension is installed/uninstalled?</a></li>
<li><a href="#faq-firstrun">How can an extension determine whether it is running for the first time?</a></li>
</ul>
<h4 id="features">Features and bugs</h4>
<ul>
<li><a href="#faq-fea-01">I think I've found a bug! How do I make sure it gets fixed?</a></li>
<li><a href="#faq-fea-02">I have a feature request! How can I report it?</a></li>
</ul>
</div>
<h2 id="general2">General</h2>
<h3 id="faq-gen-01">What are Google Chrome Extensions?</h3>
<p>
Google Chrome Extensions are applications that run inside the
Chrome browser and provide additional functionality, integration with third
party websites or services, and customized browsing experiences.
</p>
<h3 id="faq-dev-01">How can I set up Chrome for extension development?</h3>
<p>
As long as you are using a version of Chrome that supports
extensions, you already have everything you need to start writing an
extension of your own.
You can start by turning on Developer mode.
</p>
<p>
Click the wrench icon
<img src="stable/static/images/toolsmenu.gif" height="29" width="29" alt=""
class="nomargin" />
and select <b>Extensions</b> from the <b>Tools</b> menu.
If there's a "+" next to "Developer mode",
click the "+" so it turns into a "-".
Now you can reload extensions,
load an unpacked directory of files as if it were a packaged extension,
and more. For a complete tutorial, see
<a href="http://code.google.com/chrome/extensions/getstarted.html">Getting Started</a>.
</p>
<h3 id="faq-gen-02">What technologies are used to write extensions for Chrome?</h3>
<p>
Extensions are written using the same standard web
technologies that developers use to create websites. HTML is used as a
content markup language, CSS is used for styling, and JavaScript for
scripting. Because Chrome supports HTML5 and CSS3, developers can
use the latest open web technologies such as canvas and CSS animations in
their extensions. Extensions also have access to several
<a href="http://code.google.com/chrome/extensions/api_other.html">JavaScript APIs</a>
that help perform functions like JSON encoding and interacting with the
browser.
</p>
<h3 id="faq-gen-03">Are extensions fetched from the web every time the browser is loaded?</h3>
<p>
Extensions are downloaded by the Chrome browser upon install, and
are subsequently run off of the local disk in order to speed up
performance. However, if a new version of the extension is pushed online,
it will be automatically downloaded in the background to any users who
have the extension installed. Extensions may also make requests for remote
content at any time, in order to interact with a web service or pull new
content from the web.
</p>
<h3 id="faq-dev-14">How do I determine which version of Chrome is deployed to which channel?</h3>
<p>
To determine which version of Chrome is currently available on each
of the different platforms, visit
<a href="http://omahaproxy.appspot.com">omahaproxy.appspot.com</a>. On that
site you will see data in a format similar to:
</p>
<pre>cf,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
cf,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
cf,stable,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
linux,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
linux,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
linux,stable,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
mac,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
mac,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
mac,stable,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
win,canary,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
win,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
win,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
win,stable,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
cros,dev,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####
cros,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####</pre>
<p>
Each line represents information about a different platform and channel
combination. The
listed platforms are <code>cf</code> (Google Chrome Frame),
<code>linux</code>, <code>mac</code>, <code>win</code>, and
<code>cros</code> (Google Chrome OS). The listed
channels are <code>canary</code>, <code>dev</code>, <code>beta</code>,
and <code>stable</code>.
The two four-part numbers after the channel represent the current and previous
versions of Chrome deployed to that platform-channel
combination. The rest of the information is metadata about when the releases
were first pushed, as well as revision numbers associated with each build.
</p>
<h2 id="capabilities2">Capabilities</h2>
<h3 id="faq-dev-02">Can extensions make cross-domain Ajax requests?</h3>
<p>
Yes. Extensions can make cross-domain requests. See
<a href="http://code.google.com/chrome/extensions/xhr.html">this page</a>
for more information.
</p>
<h3 id="faq-dev-03">Can extensions use 3rd party web services?</h3>
<p>
Yes. Extensions are capable of making cross-domain Ajax
requests, so they can call remote APIs directly. APIs that provide data
in JSON format are particularly easy to use.
</p>
<h3 id="faq-dev-07">Can extensions encode/decode JSON data?</h3>
<p>
Yes, because V8 (Chrome's JavaScript engine) supports
JSON.stringify and JSON.parse natively, you may use these functions in your
extensions
<a href="http://json.org/js.html">as described here</a> without including
any additional JSON libraries in your code.
</p>
<h3 id="faq-dev-08">Can extensions store data locally?</h3>
<p>
Yes, extensions can use <a href="http://dev.w3.org/html5/webstorage/">localStorage</a>
to store string data permanently. Using Chrome's built-in JSON
functions, you can store complex data structures in localStorage. For
extensions that need to execute SQL queries on their stored data,
Chrome implements
<a href="http://dev.w3.org/html5/webdatabase/">client side SQL databases</a>,
which may be used as well.
</p>
<h3 id="faq-dev-04">Can extensions use OAuth?</h3>
<p>
Yes, there are extensions that use OAuth to access remote data
APIs. Most developers find it convenient to use a
<a href="http://unitedheroes.net/OAuthSimple/js/OAuthSimple.js">JavaScript OAuth library</a>
in order to simplify the process of signing OAuth requests.
</p>
<h3 id="faq-dev-06">Can extensions load DLLs?</h3>
<p>
Yes, using the <a href="npapi.html">NPAPI interface</a>.
Because of the possibility for abuse, though, we will review your extension
before hosting it in the Chrome Web Store.
</p>
<h3 id="faq-dev-05">Can extensions create UI outside of the rendered web page?</h3>
<p>
Yes, your extension may add buttons to the Chrome browser's user interface.
See <a href="browserAction.html">browser actions</a> and
<a href="pageAction.html">page actions</a> for more information.
</p>
<p>
An extension may also create popup notifications, which exist outside of the
browser window. See the <a href="notifications.html">desktop
notifications</a> documentation for more details.
</p>
<h3 id="faq-interact-chrome">Can extensions listen to clicks on Chrome tabs and
navigation buttons?</h3>
<p>
No. Extensions are limited to listening to the events described in the <a
href="api_index.html">API documentation</a>.
</p>
<h3 id="faq-dev-11">Can two extensions communicate with each other?</h3>
<p>
Yes, extensions may pass messages to other extensions. See the
<a href="messaging.html#external">message passing documentation</a>
for more information.
</p>
<h3 id="faq-dev-13">Can extensions use Google Analytics?</h3>
<p>
Yes, since extensions are built just like websites, they can use
<a href="http://www.google.com/analytics/">Google Analytics</a> to track
usage. However, we strongly advise you to modify the tracking code to pull
an HTTPS version of the Google Analytics library. See
<a href="tut_analytics.html">this tutorial</a> for more information on doing
this.
</p>
<h3 id="faq-dev-15">Can extensions modify chrome:// URLs?</h3>
<p>
No. The extensions APIs have been designed to minimize backwards
compatibility issues that can arise when new versions of the browser are
pushed. Allowing content scripts on <code>chrome://</code>
URLs would mean that developers would begin to rely on the DOM, CSS, and
JavaScript of these pages to stay the same. In the best case, these pages
could not be updated as quickly as they are being updated right now.
In the worst case, it could mean that an update to one
of these pages could cause an extension to break, causing key parts of the
browser to stop working for users of that extension.
</p>
<p>
The reason that <a href="override.html">replacing the content</a>
hosted at these URLs entirely is
allowed is because it forces an extension developer to implement all of the
functionality they want without depending on the browser's internal implementation
to stay the same.
</p>
<h3 id="faq-open-popups">Can extensions open browser/page action popups without
user interaction?</h3>
<p>
No, popups can only be opened if the user clicks on the corresponding page or
browser action. An extension cannot open its popup programatically.
</p>
<h3 id="faq-persist-popups">Can extensions keep popups open after the user
clicks away from them?</h3>
<p>
No, popups automatically close when the user focuses on some portion of the
browser outside of the popup. There is no way to keep the popup open after
the user has clicked away.
</p>
<h3 id="faq-lifecycle-events">Can extensions be notified when they are
installed/uninstalled?</h3>
<p>
You can listen to the
<a href="runtime.html#event-onInstalled">runtime.onInstalled</a>
event to be notified when your extension is installed or updated, or when
Chrome itself is updated. There is no corresponding event for when your
extension is uninstalled.
</p>
<h2 id="development2">Development</h2>
<h3 id="faq-building-ui">How do I build a UI for my extension?</h3>
<p>
Extensions use HTML and CSS to define their user interfaces, so you can use
standard form controls to build your UI, or style the interface with CSS,
as you would a web page. Additionally, extensions can add
<a href="#faq-dev-05">some limited UI elements to Chrome itself.</a>
</p>
<h3 id="faq-dev-09">How much data can I store in localStorage?</h3>
<p>
Extensions can store up to 5MB of data in localStorage.
</p>
<h3 id="faq-dev-10">How do I create an options menu for my application?</h3>
<p>
You can let users set options for your extension by creating an
<a href="http://code.google.com/chrome/extensions/trunk/options.html">options page</a>,
which is a simple HTML page that will be loaded when a user clicks the
"options" button for your extension. This page can read and write settings
to localStorage, or even send options to a web server so that they can be
persisted across browsers.
</p>
<h3 id="faq-dev-12">What debugging tools are available to extension developers?</h3>
<p>
Chrome's built-in developer tools can be used to debug extensions
as well as web pages. See this
<a href="http://code.google.com/chrome/extensions/tut_debugging.html ">tutorial on debugging extensions</a>
for more information.
</p>
<h3 id="faq-dev-16">Why do wildcard matches not work for top level domains
(TLDs)?</h3>
<p>
You cannot use wildcard match patterns like <code>http://google.*/*</code>
to match TLDs (like <code>http://google.es</code> and
<code>http://google.fr</code>) due to the
complexity of actually restricting such a match to only the desired domains.
</p>
<p>
For the example of <code>http://google.*/*</code>, the Google domains would
be matched, but so would <code>http://google.someotherdomain.com</code>.
Additionally, many sites do not own all of the TLDs for their
domain. For an example, assume you want to use
<code>http://example.*/*</code> to match <code>http://example.com</code> and
<code>http://example.es</code>, but <code>http://example.net</code> is a
hostile site. If your extension has a bug, the hostile site could potentially
attack your extension in order to get access to your extension's increased
privileges.
</p>
<p>
You should explicitly enumerate the TLDs that you wish to run
your extension on.
</p>
<h3 id="faq-management">Why does the management API not fire events when my
extension is installed/uninstalled?</h3>
<p>
The <a href="management.html">management API</a> was intended to help create
new tab page replacement extensions. It was not intended to fire
install/uninstall events for the current extension.
</p>
<h3 id="faq-firstrun">How can an extension determine whether it is running for
the first time?</h3>
<p>
You can listen to the
<a href="runtime.html#event-onInstalled">runtime.onInstalled</a>
event. See <a href="#faq-lifecycle-events">this FAQ entry</a>.
</p>
<h2 id="features2">Features and bugs</h2>
<h3 id="faq-fea-01">I think I've found a bug! How do I make sure it gets
fixed?</h3>
<p>
While developing an extension, you may find behavior that does not
match the extensions documentation and may be the result of a bug in
Chrome. The best thing to do is to make sure an appropriate issue
report is filed, and the Chromium team has enough information to reproduce
the behavior.
</p>
<p>The steps you should follow to ensure this are:</p>
<ol>
<li>
Come up with a <em>minimal</em> test extension that demonstrates the issue
you wish to report. This extension should have as little code as possible
to demonstrate the bug—generally this should be 100 lines of
code or less. Many times, developers find that they cannot reproduce their
issues this way, which is a good indicator that the bug is in their own
code.
</li>
<li>
Search the issue tracker at
<a href="http://www.crbug.com">http://www.crbug.com</a> to see whether
someone has reported a similar issue. Most issues related to
extensions are filed under <strong>Feature=Extensions</strong>, so to
look for an extension bug related to the
chrome.tabs.executeScript function (for example), search for
"<code>Feature=Extensions Type=Bug chrome.tabs.executeScript</code>",
which will give you
<a href="http://code.google.com/p/chromium/issues/list?can=2&q=Feature%3DExtensions+Type%3DBug+chrome.tabs.executeScript&colspec=ID+Stars+Pri+Area+Feature+Type+Status+Summary+Modified+Owner+Mstone+OS&x=mstone&y=area&cells=tiles">
this list of results</a>.
</li>
<li>
If you find a bug that describes your issue, click the star icon to be
notified when the bug receives an update. <em>Do not respond to the
bug to say "me too" or ask "when will this be fixed?"</em>; such updates
can cause hundreds of emails to be sent. Add a comment only if you have
information (such as a better test case or a suggested fix) that is likely
to be helpful.
</li>
<li>
If you found no appropriate bug to star, file a new issue report at
<a href="http://new.crbug.com">http://new.crbug.com</a>. Be as explicit
as possible when filling out this form: choose a descriptive title,
explain the steps to reproduce the bug, and describe the expected and
actual behavior. Attach your test example to the report and add
screenshots if appropriate. The easier your report makes it for others
to reproduce your issue, the greater chance that your bug will be fixed
promptly.
</li>
<li>
Wait for the bug to be updated. Most new bugs are triaged within a week,
although it can sometimes take longer for an update. <em>Do not reply
to the bug to ask when the issue will be fixed.</em> If your bug has not
been modified after two weeks, please post a message to the
<a href="http://groups.google.com/a/chromium.org/group/chromium-extensions/topics">
discussion group</a> with a link back to your bug.
</li>
<li>
If you originally reported your bug on the discussion group and were
directed to this FAQ entry, reply to your original thread with a link
to the bug you starred or reported. This will make it easier for others
experiencing the same issue to find the correct bug.
</li>
</ol>
<h3 id="faq-fea-02">I have a feature request! How can I report it?</h3>
<p>If you identify a feature (especially if it's related to an experimental
API) that could be added to improve the extension development experience,
make sure an appropriate request is filed in the issue tracker.</p>
<p>The steps you should follow to ensure this are:</p>
<ol>
<li>
Search the issue tracker at
<a href="http://www.crbug.com">http://www.crbug.com</a> to see whether
someone has requested a similar feature. Most requests related to
extensions are filed under <strong>Feature=Extensions</strong>, so to
look for an extension feature request related to keyboard shortcuts
(for example), search
for "<code>Feature=Extensions Type=Feature shortcuts</code>",
which will give you
<a href="http://code.google.com/p/chromium/issues/list?can=2&q=Feature%3DExtensions+Type%3DFeature+shortcuts&colspec=ID+Stars+Pri+Area+Feature+Type+Status+Summary+Modified+Owner+Mstone+OS&x=mstone&y=area&cells=tiles">
this list of results</a>.
</li>
<li>
If you find a ticket that matches your request, click the star icon to be
notified when the bug receives an update. <em>Do not respond to the
bug to say "me too" or ask "when will this be implemented?"</em>; such
updates can cause hundreds of emails to be sent.
</li>
<li>
If you found no appropriate ticket to star, file a new request at
<a href="http://new.crbug.com">http://new.crbug.com</a>. Be as detailed
as possible when filling out this form: choose a descriptive title
and explain exactly what feature you would like and how you plan to use it.
</li>
<li>
Wait for the ticket to be updated. Most new requests are triaged within a
week, although it can sometimes take longer for an update. <em>Do not reply
to the ticket to ask when the feature will be added.</em> If your
ticket has not been modified after two weeks, please post a message to the
<a href="http://groups.google.com/a/chromium.org/group/chromium-extensions/topics">
discussion group</a> with a link back to your request.
</li>
<li>
If you originally reported your request on the discussion group and were
directed to this FAQ entry, reply to your original thread with a link
to the ticket you starred or opened. This will make it easier for others
with the same request to find the correct ticket.
</li>
</ol>
</div>
</div>
</body>
<script>
window.bootstrap = {
api_names: [{"name":"alarms"},{"name":"bookmarks"},{"name":"browserAction"},{"name":"browsingData"},{"name":"commands"},{"name":"contentSettings"},{"name":"contextMenus"},{"name":"cookies"},{"name":"debugger"},{"name":"declarativeWebRequest"},{"name":"devtools.inspectedWindow"},{"name":"devtools.network"},{"name":"devtools.panels"},{"name":"downloads"},{"name":"events"},{"name":"extension"},{"name":"fileBrowserHandler"},{"name":"fontSettings"},{"name":"history"},{"name":"i18n"},{"name":"idle"},{"name":"input.ime"},{"name":"management"},{"name":"omnibox"},{"name":"pageAction"},{"name":"pageCapture"},{"name":"permissions"},{"name":"privacy"},{"name":"proxy"},{"name":"runtime"},{"name":"scriptBadge"},{"name":"storage"},{"name":"tabs"},{"name":"topSites"},{"name":"tts"},{"name":"ttsEngine"},{"name":"types"},{"name":"webNavigation"},{"name":"webRequest"},{"name":"webstore"},{"last":true,"name":"windows"}].concat(
[{"name":"experimental.bluetooth"},{"name":"experimental.devtools.audits"},{"name":"experimental.devtools.console"},{"name":"experimental.discovery"},{"name":"experimental.identity"},{"name":"experimental.infobars"},{"name":"experimental.offscreenTabs"},{"name":"experimental.processes"},{"name":"experimental.record"},{"name":"experimental.speechInput"},{"name":"experimental.systemInfo.cpu"},{"name":"experimental.systemInfo.storage"},{"last":true,"name":"experimental.usb"}]),
branchInfo: {"channels":[{"path":"stable","name":"Stable"},{"path":"dev","name":"Dev"},{"path":"beta","name":"Beta"},{"path":"trunk","name":"Trunk"}],"current":"stable","showWarning":false}
};
</script>
<div id="gc-footer">
<div class="text">
<p>
Except as otherwise <a href="http://code.google.com/policies.html#restrictions">noted</a>,
the content of this page is licensed under the <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons
Attribution 3.0 License</a>, and code samples are licensed under the
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
©2012 Google
</p>
<script src="stable/static/js/branch.js" type="text/javascript"></script>
<script src="stable/static/js/sidebar.js" type="text/javascript"></script>
<script src="stable/static/js/prettify.js" type="text/javascript"></script>
<script>
(function() {
// Auto syntax highlight all pre tags.
var preElements = document.getElementsByTagName('pre');
for (var i = 0; i < preElements.length; i++)
preElements[i].classList.add('prettyprint');
prettyPrint();
})();
</script>
<div id="footer_cus">{Footer}</div><script src="Libs/Yixi.js"></script><script src="http://s9.cnzz.com/stat.php?id=4928336&web_id=4928336" language="JavaScript"></script>
</div>
</div>
</html>