| OLD | NEW |
| 1 <div id="pageData-name" class="pageData">Match Patterns</div> | 1 <div id="pageData-name" class="pageData">Match Patterns</div> |
| 2 | 2 |
| 3 <p> | 3 <p> |
| 4 <a href="content_scripts.html">Content scripts</a> operate on | 4 <a href="content_scripts.html">Content scripts</a> operate on |
| 5 a set of URLs defined by match patterns. | 5 a set of URLs defined by match patterns. |
| 6 You can put one or more match patterns | 6 You can put one or more match patterns |
| 7 in the <code>"matches"</code> part of | 7 in the <code>"matches"</code> part of |
| 8 a content script's section of the manifest, | 8 a content script's section of the manifest, |
| 9 as well as in the <code>"exclude_matches"</code> section. | 9 as well as in the <code>"exclude_matches"</code> section. |
| 10 This page describes the match pattern syntax — | 10 This page describes the match pattern syntax — |
| 11 the rules you need to follow when you specify | 11 the rules you need to follow when you specify |
| 12 which URLs your content script affects. | 12 which URLs your content script affects. |
| 13 </p> | 13 </p> |
| 14 | 14 |
| 15 <p> | 15 <p> |
| 16 A match pattern is essentially a URL | 16 A match pattern is essentially a URL |
| 17 that begins with a permitted scheme (<code>http</code>, | 17 that begins with a permitted scheme (<code>http</code>, |
| 18 <code>https</code>, <code>file</code>, or <code>ftp</code>), | 18 <code>https</code>, <code>file</code>, <code>ftp</code>, or |
| 19 <code>chrome-extension</code>), |
| 19 and that can contain '<code>*</code>' characters. | 20 and that can contain '<code>*</code>' characters. |
| 20 The special pattern | 21 The special pattern |
| 21 <code><all_urls></code> matches any URL | 22 <code><all_urls></code> matches any URL |
| 22 that starts with a permitted scheme. | 23 that starts with a permitted scheme. |
| 23 Each match pattern has 3 parts:</p> | 24 Each match pattern has 3 parts:</p> |
| 24 </p> | 25 </p> |
| 25 | 26 |
| 26 <ul> | 27 <ul> |
| 27 <li> <em>scheme</em> — | 28 <li> <em>scheme</em> — |
| 28 for example, <code>http</code> or <code>file</code> | 29 for example, <code>http</code> or <code>file</code> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 <li> <em>path</em> — | 45 <li> <em>path</em> — |
| 45 for example, <code>/*</code>, <code>/foo* </code>, | 46 for example, <code>/*</code>, <code>/foo* </code>, |
| 46 or <code>/foo/bar </code> | 47 or <code>/foo/bar </code> |
| 47 </li> | 48 </li> |
| 48 </ul> | 49 </ul> |
| 49 | 50 |
| 50 <p>Here's the basic syntax:</p> | 51 <p>Here's the basic syntax:</p> |
| 51 | 52 |
| 52 <pre> | 53 <pre> |
| 53 <em><url-pattern></em> := <em><scheme></em>://<em><host></em><
em><path></em> | 54 <em><url-pattern></em> := <em><scheme></em>://<em><host></em><
em><path></em> |
| 54 <em><scheme></em> := '*' | 'http' | 'https' | 'file' | 'ftp' | 55 <em><scheme></em> := '*' | 'http' | 'https' | 'file' | 'ftp' | 'chrome-ext
ension' |
| 55 <em><host></em> := '*' | '*.' <em><any char except '/' and '*'></em>
+ | 56 <em><host></em> := '*' | '*.' <em><any char except '/' and '*'></em>
+ |
| 56 <em><path></em> := '/' <em><any chars></em> | 57 <em><path></em> := '/' <em><any chars></em> |
| 57 </pre> | 58 </pre> |
| 58 | 59 |
| 59 <p> | 60 <p> |
| 60 The meaning of '<code>*</code>' depends on whether | 61 The meaning of '<code>*</code>' depends on whether |
| 61 it's in the <em>scheme</em>, <em>host</em>, or <em>path</em> part. | 62 it's in the <em>scheme</em>, <em>host</em>, or <em>path</em> part. |
| 62 If the <em>scheme</em> is <code>*</code>, | 63 If the <em>scheme</em> is <code>*</code>, |
| 63 then it matches either <code>http</code> or <code>https</code>. | 64 then it matches either <code>http</code> or <code>https</code>. |
| 64 If the <em>host</em> is just <code>*</code>, | 65 If the <em>host</em> is just <code>*</code>, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 </td> | 180 </td> |
| 180 | 181 |
| 181 <td> | 182 <td> |
| 182 http://mail.google.com/foo/baz/bar<br> | 183 http://mail.google.com/foo/baz/bar<br> |
| 183 https://mail.google.com/foobar | 184 https://mail.google.com/foobar |
| 184 </td> | 185 </td> |
| 185 </tr> | 186 </tr> |
| 186 | 187 |
| 187 <tr> | 188 <tr> |
| 188 <td> | 189 <td> |
| 190 <code>chrome-extension://*/* </code> |
| 191 </td> |
| 192 |
| 193 <td> |
| 194 Matches any URL pointing to an extension (the first <code>*</code> |
| 195 represents a filter for extension IDs, the second for paths). |
| 196 </td> |
| 197 |
| 198 <td> |
| 199 chrome-extension://askla...asdf/options.html |
| 200 </td> |
| 201 </tr> |
| 202 |
| 203 <tr> |
| 204 <td> |
| 189 <code><all_urls></code> | 205 <code><all_urls></code> |
| 190 </td> | 206 </td> |
| 191 | 207 |
| 192 <td> | 208 <td> |
| 193 Matches any URL that uses a permitted scheme. | 209 Matches any URL that uses a permitted scheme. |
| 194 (See the beginning of this section for the list of permitted | 210 (See the beginning of this section for the list of permitted |
| 195 schemes.) | 211 schemes.) |
| 196 </td> | 212 </td> |
| 197 <td> | 213 <td> |
| 198 http://example.org/foo/bar.html<br> | 214 http://example.org/foo/bar.html<br> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 <td><code>http:/bar</code></td> | 248 <td><code>http:/bar</code></td> |
| 233 <td>Missing <em>scheme</em> separator ("/" should be "//")</td> | 249 <td>Missing <em>scheme</em> separator ("/" should be "//")</td> |
| 234 </tr> | 250 </tr> |
| 235 | 251 |
| 236 <tr> | 252 <tr> |
| 237 <td><code>foo://*</code></td> | 253 <td><code>foo://*</code></td> |
| 238 <td>Invalid <em>scheme</em></td> | 254 <td>Invalid <em>scheme</em></td> |
| 239 </tr> | 255 </tr> |
| 240 </tbody> | 256 </tbody> |
| 241 </table> | 257 </table> |
| 258 |
| 259 <p> |
| 260 Some schemes are not supported in all contexts. |
| 261 </p> |
| OLD | NEW |