OLD | NEW |
---|---|
1 <h1>Match Patterns</h1> | 1 <h1>Match Patterns</h1> |
2 | 2 |
3 <p> | 3 <p> |
4 <a href="declare_permissions.html#host-permissions">Host | 4 <a href="declare_permissions.html#host-permissions">Host |
5 permissions</a> and <a href="content_scripts.html">content | 5 permissions</a> and <a href="content_scripts.html">content |
6 script</a> matching are based on a set of URLs defined by | 6 script</a> matching are based on a set of URLs defined by |
7 <dfn>match patterns</dfn>. A match pattern is essentially a | 7 <dfn>match patterns</dfn>. A match pattern is essentially a |
8 URL that begins with a permitted scheme (<code>http</code>, | 8 URL that begins with a permitted scheme (<code>http</code>, |
9 <code>https</code>, <code>file</code>, <code>ftp</code>, or | 9 <code>https</code>, <code>file</code>, <code>ftp</code>, or |
10 <code>chrome-extension</code>), | 10 <code>chrome-extension</code>), |
(...skipping 27 matching lines...) Expand all Loading... | |
38 or <code>/foo/bar</code>. The path must be present in a | 38 or <code>/foo/bar</code>. The path must be present in a |
39 host permission, but is always treated | 39 host permission, but is always treated |
40 as <code>/*</code>. | 40 as <code>/*</code>. |
41 </li> | 41 </li> |
42 </ul> | 42 </ul> |
43 | 43 |
44 <p>Here's the basic syntax:</p> | 44 <p>Here's the basic syntax:</p> |
45 | 45 |
46 <pre> | 46 <pre> |
47 <em><url-pattern></em> := <em><scheme></em>://<em><host></em>< em><path></em> | 47 <em><url-pattern></em> := <em><scheme></em>://<em><host></em>< em><path></em> |
48 <em><scheme></em> := '*' | 'http' | 'https' | 'file' | 'ftp' | 'chrome-ext ension' | 48 <em><scheme></em> := '*' | 'http' | 'https' | 'file' | 'ftp' | 'chrome-ext ension' | 'about' |
49 <em><host></em> := '*' | '*.' <em><any char except '/' and '*'></em> + | 49 <em><host></em> := '*' | '*.' <em><any char except '/' and '*'></em> + |
50 <em><path></em> := '/' <em><any chars></em> | 50 <em><path></em> := '/' <em><any chars></em> |
51 </pre> | 51 </pre> |
52 | 52 |
53 <p> | 53 <p> |
54 The meaning of '<code>*</code>' depends on whether | 54 The meaning of '<code>*</code>' depends on whether |
55 it's in the <em>scheme</em>, <em>host</em>, or <em>path</em> part. | 55 it's in the <em>scheme</em>, <em>host</em>, or <em>path</em> part. |
56 If the <em>scheme</em> is <code>*</code>, | 56 If the <em>scheme</em> is <code>*</code>, |
57 then it matches either <code>http</code> or <code>https</code>, | 57 then it matches either <code>http</code> or <code>https</code>, |
58 and <strong>not</strong> <code>file</code>, <code>ftp</code>, | 58 and <strong>not</strong> <code>file</code>, <code>ftp</code>, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 </td> | 175 </td> |
176 | 176 |
177 <td> | 177 <td> |
178 http://mail.google.com/foo/baz/bar<br> | 178 http://mail.google.com/foo/baz/bar<br> |
179 https://mail.google.com/foobar | 179 https://mail.google.com/foobar |
180 </td> | 180 </td> |
181 </tr> | 181 </tr> |
182 | 182 |
183 <tr> | 183 <tr> |
184 <td> | 184 <td> |
185 <code>about:* </code> | |
186 </td> | |
187 | |
188 <td> | |
189 Matches any URL that uses the <code>about</code> scheme. | |
190 Content scripts matching this pattern are only inserted if the page was | |
191 loaded by a page whose URL matches at least one of the other declared | |
192 patterns. | |
not at google - send to devlin
2014/04/18 16:04:55
what about top-level about: frames?
| |
193 </td> | |
194 | |
195 <td> | |
196 about:blank<br> | |
197 about:srcdoc | |
198 </td> | |
199 </tr> | |
200 | |
201 <tr> | |
202 <td> | |
185 <code>chrome-extension://*/* </code> | 203 <code>chrome-extension://*/* </code> |
186 </td> | 204 </td> |
187 | 205 |
188 <td> | 206 <td> |
189 Matches any URL pointing to an extension (the first <code>*</code> | 207 Matches any URL pointing to an extension (the first <code>*</code> |
190 represents a filter for extension IDs, the second for paths). | 208 represents a filter for extension IDs, the second for paths). |
191 </td> | 209 </td> |
192 | 210 |
193 <td> | 211 <td> |
194 chrome-extension://askla...asdf/options.html | 212 chrome-extension://askla...asdf/options.html |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 <tr> | 265 <tr> |
248 <td><code>foo://*</code></td> | 266 <td><code>foo://*</code></td> |
249 <td>Invalid <em>scheme</em></td> | 267 <td>Invalid <em>scheme</em></td> |
250 </tr> | 268 </tr> |
251 </tbody> | 269 </tbody> |
252 </table> | 270 </table> |
253 | 271 |
254 <p> | 272 <p> |
255 Some schemes are not supported in all contexts. | 273 Some schemes are not supported in all contexts. |
256 </p> | 274 </p> |
OLD | NEW |