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

Side by Side Diff: chrome/common/extensions/docs/match_patterns.html

Issue 10642015: Basic setup for generating app docs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc. Note:
2 1) The <head> information in this page is significant, should be uniform
3 across api docs and should be edited only with knowledge of the
4 templating mechanism.
5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a
6 browser, it will be re-generated from the template, json schema and
7 authored overview content.
8 4) The <body>.innerHTML is also generated by an offline step so that this
9 page may easily be indexed by search engines.
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head>
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css">
13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print">
14 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla te_compiled.js">
15 </script>
16 <script type="text/javascript" src="../../../../third_party/json_minify/mini fy-sans-regexp.js">
17 </script>
18 <script type="text/javascript" src="js/api_page_generator.js"></script>
19 <script type="text/javascript" src="js/bootstrap.js"></script>
20 <script type="text/javascript" src="js/sidebar.js"></script>
21 <title>Match Patterns - Google Chrome Extensions - Google Code</title></head>
22 <body> <div id="devModeWarning" class="displayModeWarning">
23 You are viewing extension docs in chrome via the 'file:' scheme: are you exp ecting to see local changes when you refresh? You'll need run chrome with --allo w-file-access-from-files.
24 </div>
25 <div id="branchWarning" class="displayModeWarning">
26 <span>WARNING: This is the <span id="branchName">BETA</span> documentation.
27 It may not work with the stable release of Chrome.</span>
28 <select id="branchChooser">
29 <option>Choose a different version...
30 </option><option value="">Stable
31 </option><option value="beta">Beta
32 </option><option value="dev">Dev
33 </option><option value="trunk">Trunk
34 </option></select>
35 </div>
36 <div id="unofficialWarning" class="displayModeWarning">
37 <span>WARNING: This is unofficial documentation. It may not work with the
38 current release of Chrome.</span>
39 <button id="goToOfficialDocs">Go to the official docs</button>
40 </div>
41 <div id="gc-container" class="labs">
42 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION -->
43 <!-- In particular, sub-templates that recurse, must be used by allowing
44 jstemplate to make a copy of the template in this section which
45 are not operated on by way of the jsskip="true" -->
46 <!-- /SUBTEMPLATES -->
47 <a id="top"></a>
48 <div id="skipto">
49 <a href="#gc-pagecontent">Skip to page content</a>
50 <a href="#gc-toc">Skip to main navigation</a>
51 </div>
52 <!-- API HEADER -->
53 <table id="header" width="100%" cellspacing="0" border="0">
54 <tbody><tr>
55 <td valign="middle"><a href="http://code.google.com/"><img src="images/c ode_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border: 0; margin:0;"></a></td>
56 <td valign="middle" width="100%" style="padding-left:0.6em;">
57 <form action="http://www.google.com/cse" id="cse" style="margin-top:0. 5em">
58 <div id="gsc-search-box">
59 <input type="hidden" name="cx" value="002967670403910741006:61_cvz fqtno">
60 <input type="hidden" name="ie" value="UTF-8">
61 <input type="text" name="q" value="" size="55">
62 <input class="gsc-search-button" type="submit" name="sa" value="Se arch">
63 <br>
64 <span class="greytext">e.g. "page action" or "tabs"</span>
65 </div>
66 </form>
67 <script type="text/javascript" src="https://www.google.com/jsapi"></sc ript>
68 <script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script>
69 <script type="text/javascript" src="https://www.google.com/coop/cse/t1 3n?form=cse&amp;t13n_langs=en"></script>
70 <script type="text/javascript" src="https://www.google.com/coop/cse/br and?form=cse&amp;lang=en"></script>
71 </td>
72 </tr>
73 </tbody></table>
74 <div id="codesiteContent" class="">
75 <a id="gc-topnav-anchor"></a>
76 <div id="gc-topnav">
77 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Lab s</a>)</h1>
78 <ul id="home" class="gc-topnav-tabs">
79 <li id="home_link">
80 <a href="index.html" title="Google Chrome Extensions home page">Home </a>
81 </li>
82 <li id="docs_link">
83 <a href="docs.html" title="Official Google Chrome Extensions documen tation">Docs</a>
84 </li>
85 <li id="faq_link">
86 <a href="faq.html" title="Answers to frequently asked questions abou t Google Chrome Extensions">FAQ</a>
87 </li>
88 <li id="samples_link">
89 <a href="samples.html" title="Sample extensions (with source code)"> Samples</a>
90 </li>
91 <li id="group_link">
92 <a href="http://groups.google.com/a/chromium.org/group/chromium-exte nsions" title="Google Chrome Extensions developer forum">Group</a>
93 </li>
94 <li id="so_link">
95 <a href="http://stackoverflow.com/questions/tagged/google-chrome-ext ension" title="[google-chrome-extension] tag on Stack Overflow">Questions?</a>
96 </li>
97 </ul>
98 </div> <!-- end gc-topnav -->
99 <div class="g-section g-tpl-170">
100 <!-- SIDENAV -->
101 <div class="g-unit g-first" id="gc-toc">
102 <ul>
103 <li><a href="getstarted.html">Getting Started</a></li>
104 <li><a href="overview.html">Overview</a></li>
105 <li><a href="whats_new.html">What's New?</a></li>
106 <li><h2><a href="devguide.html">Developer's Guide</a></h2>
107 <ul>
108 <li>Browser UI
109 <ul>
110 <li><a href="browserAction.html">Browser Actions</a></li>
111 <li><a href="contextMenus.html">Context Menus</a></li>
112 <li><a href="notifications.html">Desktop Notifications</a></li >
113 <li><a href="omnibox.html">Omnibox</a></li>
114 <li><a href="options.html">Options Pages</a></li>
115 <li><a href="override.html">Override Pages</a></li>
116 <li><a href="pageAction.html">Page Actions</a></li>
117 </ul>
118 </li>
119 <li>Browser Interaction
120 <ul>
121 <li><a href="bookmarks.html">Bookmarks</a></li>
122 <li><a href="cookies.html">Cookies</a></li>
123 <li><a href="devtools.html">Developer Tools</a></li>
124 <li><a href="events.html">Events</a></li>
125 <li><a href="history.html">History</a></li>
126 <li><a href="management.html">Management</a></li>
127 <li><a href="tabs.html">Tabs</a></li>
128 <li><a href="windows.html">Windows</a></li>
129 </ul>
130 </li>
131 <li>Implementation
132 <ul>
133 <li><a href="a11y.html">Accessibility</a></li>
134 <li><a href="background_pages.html">Background Pages</a></li>
135 <li><a href="content_scripts.html">Content Scripts</a></li>
136 <li><a href="xhr.html">Cross-Origin XHR</a></li>
137 <li><a href="i18n.html">Internationalization</a></li>
138 <li><a href="messaging.html">Message Passing</a></li>
139 <li><a href="permissions.html">Optional Permissions</a></li>
140 <li><a href="npapi.html">NPAPI Plugins</a></li>
141 </ul>
142 </li>
143 <li>Finishing
144 <ul>
145 <li><a href="hosting.html">Hosting</a></li>
146 <li><a href="external_extensions.html">Other Deployment Option s</a></li>
147 </ul>
148 </li>
149 </ul>
150 </li>
151 <li><h2><a href="apps.html">Packaged Apps</a></h2></li>
152 <li><h2><a href="tutorials.html">Tutorials</a></h2>
153 <ul>
154 <li><a href="tut_debugging.html">Debugging</a></li>
155 <li><a href="tut_analytics.html">Google Analytics</a></li>
156 <li><a href="tut_oauth.html">OAuth</a></li>
157 </ul>
158 </li>
159 <li><h2>Reference</h2>
160 <ul>
161 <li>Formats
162 <ul>
163 <li><a href="manifest.html">Manifest Files</a></li>
164 <li class="leftNavSelected">Match Patterns</li>
165 </ul>
166 </li>
167 <li><a href="permission_warnings.html">Permission Warnings</a></li >
168 <li><a href="api_index.html">chrome.* APIs</a></li>
169 <li><a href="api_other.html">Other APIs</a></li>
170 </ul>
171 </li>
172 <li><h2><a href="samples.html">Samples</a></h2></li>
173 <div class="line"> </div>
174 <li><h2>More</h2>
175 <ul>
176 <li><a href="http://code.google.com/chrome/webstore/docs/index.htm l">Chrome Web Store</a></li>
177 <li><a href="http://code.google.com/chrome/apps/docs/developers_gu ide.html">Hosted Apps</a></li>
178 <li><a href="themes.html">Themes</a></li>
179 </ul>
180 </li>
181 </ul>
182 </div>
183 <script>
184 initToggles();
185 </script>
186 <div class="g-unit" id="gc-pagecontent">
187 <div id="pageTitle">
188 <h1 class="page_title">Match Patterns</h1>
189 </div>
190 <!-- TABLE OF CONTENTS -->
191 <!-- /TABLE OF CONTENTS -->
192 <!-- Standard content lead-in for experimental API pages -->
193 <!-- STATIC CONTENT PLACEHOLDER -->
194 <div id="static"><div id="pageData-name" class="pageData">Match Patterns </div>
195 <p>
196 <a href="content_scripts.html">Content scripts</a> operate on
197 a set of URLs defined by match patterns.
198 You can put one or more match patterns
199 in the <code>"matches"</code> part of
200 a content script's section of the manifest,
201 as well as in the <code>"exclude_matches"</code> section.
202 This page describes the match pattern syntax —
203 the rules you need to follow when you specify
204 which URLs your content script affects.
205 </p>
206 <p>
207 A match pattern is essentially a URL
208 that begins with a permitted scheme (<code>http</code>,
209 <code>https</code>, <code>file</code>, <code>ftp</code>, or
210 <code>chrome-extension</code>),
211 and that can contain '<code>*</code>' characters.
212 The special pattern
213 <code>&lt;all_urls&gt;</code> matches any URL
214 that starts with a permitted scheme.
215 Each match pattern has 3 parts:</p>
216 <p></p>
217 <ul>
218 <li> <em>scheme</em> —
219 for example, <code>http</code> or <code>file</code>
220 or <code>*</code>
221 <p class="note">
222 <b>Note:</b>
223 Access to <code>file</code> URLs isn't automatic.
224 The user must visit the extensions management page
225 and opt in to <code>file</code> access for each extension that requests it.
226 </p>
227 </li>
228 <li> <em>host</em> —
229 for example, <code>www.google.com</code>
230 or <code>*.google.com</code>
231 or <code>*</code>;
232 if the scheme is <code>file</code>,
233 there is no <em>host</em> part
234 </li>
235 <li> <em>path</em> —
236 for example, <code>/*</code>, <code>/foo* </code>,
237 or <code>/foo/bar </code>
238 </li>
239 </ul>
240 <p>Here's the basic syntax:</p>
241 <pre><em>&lt;url-pattern&gt;</em> := <em>&lt;scheme&gt;</em>://<em>&lt;host&gt;< /em><em>&lt;path&gt;</em>
242 <em>&lt;scheme&gt;</em> := '*' | 'http' | 'https' | 'file' | 'ftp' | 'chrome-ext ension'
243 <em>&lt;host&gt;</em> := '*' | '*.' <em>&lt;any char except '/' and '*'&gt;</em> +
244 <em>&lt;path&gt;</em> := '/' <em>&lt;any chars&gt;</em>
245 </pre>
246 <p>
247 The meaning of '<code>*</code>' depends on whether
248 it's in the <em>scheme</em>, <em>host</em>, or <em>path</em> part.
249 If the <em>scheme</em> is <code>*</code>,
250 then it matches either <code>http</code> or <code>https</code>.
251 If the <em>host</em> is just <code>*</code>,
252 then it matches any host.
253 If the <em>host</em> is <code>*.<em>hostname</em></code>,
254 then it matches the specified host or any of its subdomains.
255 In the <em>path</em> section,
256 each '<code>*</code>' matches 0 or more characters.
257 The following table shows some valid patterns.
258 </p>
259 <table class="columns">
260 <tbody>
261 <tr>
262 <th style="margin-left:0; padding-left:0">Pattern</th>
263 <th style="margin-left:0; padding-left:0">What it does</th>
264 <th style="margin-left:0; padding-left:0">Examples of matching URLs</th>
265 </tr>
266 <tr>
267 <td>
268 <code>http://*/*</code>
269 </td>
270 <td>Matches any URL that uses the <code>http</code> scheme</td>
271 <td>
272 http://www.google.com/<br>
273 http://example.org/foo/bar.html
274 </td>
275 </tr>
276 <tr>
277 <td>
278 <code>http://*/foo*</code>
279 </td>
280 <td>
281 Matches any URL that uses the <code>http</code> scheme, on any host,
282 as long as the path starts with <code>/foo</code>
283 </td>
284 <td>
285 http://example.com/foo/bar.html<br>
286 http://www.google.com/foo<b></b>
287 </td>
288 </tr>
289 <tr>
290 <td>
291 <code>https://*.google.com/foo*bar </code>
292 </td>
293 <td>
294 Matches any URL that uses the <code>https</code> scheme,
295 is on a google.com host
296 (such as www.google.com, docs.google.com, or google.com),
297 as long as the path starts with <code>/foo</code>
298 and ends with <code>bar</code>
299 </td>
300 <td>
301 http://www.google.com/foo/baz/bar<br>
302 http://docs.google.com/foobar
303 </td>
304 </tr>
305 <tr>
306 <td>
307 <code>http://example.org/foo/bar.html </code>
308 </td>
309 <td>Matches the specified URL</td>
310 <td>
311 http://example.org/foo/bar.html
312 </td>
313 </tr>
314 <tr>
315 <td>
316 <code>file:///foo*</code>
317 </td>
318 <td>Matches any local file whose path starts with <code>/foo</code>
319 </td>
320 <td>
321 file:///foo/bar.html<br>
322 file:///foo
323 </td>
324 </tr>
325 <tr>
326 <td>
327 <code>http://127.0.0.1/*</code>
328 </td>
329 <td>
330 Matches any URL that uses the <code>http</code> scheme
331 and is on the host 127.0.0.1
332 </td>
333 <td>
334 http://127.0.0.1/<br>
335 http://127.0.0.1/foo/bar.html
336 </td>
337 </tr>
338 <tr>
339 <td>
340 <code>*://mail.google.com/* </code>
341 </td>
342 <td>
343 Matches any URL that starts with
344 <code>http://mail.google.com</code> or
345 <code>https://mail.google.com</code>.
346 </td>
347 <td>
348 http://mail.google.com/foo/baz/bar<br>
349 https://mail.google.com/foobar
350 </td>
351 </tr>
352 <tr>
353 <td>
354 <code>chrome-extension://*/* </code>
355 </td>
356 <td>
357 Matches any URL pointing to an extension (the first <code>*</code>
358 represents a filter for extension IDs, the second for paths).
359 </td>
360 <td>
361 chrome-extension://askla...asdf/options.html
362 </td>
363 </tr>
364 <tr>
365 <td>
366 <code>&lt;all_urls&gt;</code>
367 </td>
368 <td>
369 Matches any URL that uses a permitted scheme.
370 (See the beginning of this section for the list of permitted
371 schemes.)
372 </td>
373 <td>
374 http://example.org/foo/bar.html<br>
375 file:///bar/baz.html
376 </td>
377 </tr>
378 </tbody>
379 </table>
380 <p>
381 Here are some examples of <em>invalid</em> pattern matches:
382 </p>
383 <table class="columns">
384 <tbody>
385 <tr>
386 <th style="margin-left:0; padding-left:0">Bad pattern</th>
387 <th style="margin-left:0; padding-left:0">Why it's bad</th>
388 </tr>
389 <tr>
390 <td><code>http://www.google.com</code></td>
391 <td>No <em>path</em></td>
392 </tr>
393 <tr>
394 <td><code>http://*foo/bar</code></td>
395 <td>'*' in the <em>host</em> can be followed only by a '.' or '/'</td>
396 </tr>
397 <tr>
398 <td><code>http://foo.*.bar/baz&nbsp; </code></td>
399 <td>If '*' is in the <em>host</em>, it must be the first character</td>
400 </tr>
401 <tr>
402 <td><code>http:/bar</code></td>
403 <td>Missing <em>scheme</em> separator ("/" should be "//")</td>
404 </tr>
405 <tr>
406 <td><code>foo://*</code></td>
407 <td>Invalid <em>scheme</em></td>
408 </tr>
409 </tbody>
410 </table>
411 <p>
412 Some schemes are not supported in all contexts.
413 </p>
414 </div>
415 <!-- API PAGE -->
416 <!-- /apiPage -->
417 </div> <!-- /gc-pagecontent -->
418 </div> <!-- /g-section -->
419 </div> <!-- /codesiteContent -->
420 <div id="gc-footer" --="">
421 <div class="text">
422 <p>
423 Except as otherwise <a href="http://code.google.com/policies.html#restrictions ">noted</a>,
424 the content of this page is licensed under the <a rel="license" href="http://c reativecommons.org/licenses/by/3.0/">Creative Commons
425 Attribution 3.0 License</a>, and code samples are licensed under the
426 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic ense</a>.
427 </p>
428 <p>
429 ©2011 Google
430 </p>
431 <!-- begin analytics -->
432 <script src="https://www.google-analytics.com/urchin.js" type="text/javascript"> </script>
433 <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></sc ript>
434 <script type="text/javascript">
435 // chrome doc tracking
436 try {
437 var engdocs = _gat._getTracker("YT-10763712-2");
438 engdocs._trackPageview();
439 } catch(err) {}
440 // code.google.com site-wide tracking
441 try {
442 _uacct="UA-18071-1";
443 _uanchor=1;
444 _uff=0;
445 urchinTracker();
446 }
447 catch(e) {/* urchinTracker not available. */}
448 </script>
449 <!-- end analytics -->
450 </div>
451 </div> <!-- /gc-footer -->
452 </div> <!-- /gc-container -->
453 </body></html>
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/manifestVersion.html ('k') | chrome/common/extensions/docs/messaging.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698