OLD | NEW |
1 <div id="pageData-title" class="pageData">Match Patterns</div> | 1 <div id="pageData-title" 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 This page describes the match pattern syntax — | 9 This page describes the match pattern syntax — |
10 the rules you need to follow when you specify | 10 the rules you need to follow when you specify |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 The following table shows some valid patterns. | 52 The following table shows some valid patterns. |
53 </p> | 53 </p> |
54 | 54 |
55 <table> | 55 <table> |
56 <tbody> | 56 <tbody> |
57 <tr> | 57 <tr> |
58 <th>Pattern</th> | 58 <th>Pattern</th> |
59 <th>What it does</th> | 59 <th>What it does</th> |
60 <th>Examples of matching URLs</th> | 60 <th>Examples of matching URLs</th> |
61 </tr> | 61 </tr> |
62 | 62 |
63 <tr> | 63 <tr> |
64 <td> | 64 <td> |
65 <code>http://*/*</code> | 65 <code>http://*/*</code> |
66 </td> | 66 </td> |
67 | 67 |
68 <td>Matches any URL that uses the <code>http</code> scheme</td> | 68 <td>Matches any URL that uses the <code>http</code> scheme</td> |
69 | 69 |
70 <td> | 70 <td> |
71 http://www.google.com/<br> | 71 http://www.google.com/<br> |
72 http://example.org/foo/bar.html | 72 http://example.org/foo/bar.html |
73 </td> | 73 </td> |
74 </tr> | 74 </tr> |
75 | 75 |
76 <tr> | 76 <tr> |
77 <td> | 77 <td> |
78 <code>http://*/foo*</code> | 78 <code>http://*/foo*</code> |
79 </td> | 79 </td> |
80 | 80 |
81 <td> | 81 <td> |
82 Matches any URL that uses the <code>http</code> scheme, on any host, | 82 Matches any URL that uses the <code>http</code> scheme, on any host, |
83 as long as the path starts with <code>/foo</code> | 83 as long as the path starts with <code>/foo</code> |
84 </td> | 84 </td> |
85 | 85 |
86 <td> | 86 <td> |
87 http://example.com/foo/bar.html<br> | 87 http://example.com/foo/bar.html<br> |
88 http://www.google.com/foo<b></b> | 88 http://www.google.com/foo<b></b> |
89 </td> | 89 </td> |
90 </tr> | 90 </tr> |
91 | 91 |
92 <tr> | 92 <tr> |
93 <td> | 93 <td> |
94 <code>https://*.google.com/foo*bar </code> | 94 <code>https://*.google.com/foo*bar </code> |
95 </td> | 95 </td> |
96 | 96 |
97 <td> | 97 <td> |
98 Matches any URL that uses the <code>https</code> scheme, | 98 Matches any URL that uses the <code>https</code> scheme, |
99 is on a google.com host | 99 is on a google.com host |
100 (such as www.google.com, docs.google.com, or google.com), | 100 (such as www.google.com, docs.google.com, or google.com), |
101 as long as the path starts with <code>/foo</code> | 101 as long as the path starts with <code>/foo</code> |
102 and ends with <code>bar</code> | 102 and ends with <code>bar</code> |
103 </td> | 103 </td> |
104 | 104 |
105 <td> | 105 <td> |
106 http://www.google.com/foo/baz/bar<br> | 106 http://www.google.com/foo/baz/bar<br> |
107 http://docs.google.com/foobar | 107 http://docs.google.com/foobar |
108 </td> | 108 </td> |
109 </tr> | 109 </tr> |
110 | 110 |
111 <tr> | 111 <tr> |
112 <td> | 112 <td> |
113 <code>http://example.org/foo/bar.html </code> | 113 <code>http://example.org/foo/bar.html </code> |
114 </td> | 114 </td> |
115 | 115 |
116 <td>Matches the specified URL</td> | 116 <td>Matches the specified URL</td> |
117 | 117 |
118 <td> | 118 <td> |
119 http://example.org/foo/bar.html | 119 http://example.org/foo/bar.html |
120 </td> | 120 </td> |
121 </tr> | 121 </tr> |
122 | 122 |
123 <tr> | 123 <tr> |
124 <td> | 124 <td> |
125 <code>file:///foo*</code> | 125 <code>file:///foo*</code> |
126 </td> | 126 </td> |
127 | 127 |
128 <td>Matches any local file whose path starts with <code>/foo</code></td> | 128 <td>Matches any local file whose path starts with <code>/foo</code></td> |
129 | 129 |
130 <td> | 130 <td> |
131 file:///foo/bar.html<br> | 131 file:///foo/bar.html<br> |
132 file:///foo | 132 file:///foo |
133 </td> | 133 </td> |
134 </tr> | 134 </tr> |
135 | 135 |
136 <tr> | 136 <tr> |
137 <td> | 137 <td> |
138 <code>http://127.0.0.1/*</code> | 138 <code>http://127.0.0.1/*</code> |
139 </td> | 139 </td> |
140 | 140 |
141 <td> | 141 <td> |
142 Matches any URL that uses the <code>http</code> scheme | 142 Matches any URL that uses the <code>http</code> scheme |
143 and is on the host 127.0.0.1 | 143 and is on the host 127.0.0.1 |
144 </td> | 144 </td> |
145 <td> | 145 <td> |
146 http://127.0.0.1/<br> | 146 http://127.0.0.1/<br> |
147 http://127.0.0.1/foo/bar.html | 147 http://127.0.0.1/foo/bar.html |
148 </td> | 148 </td> |
149 </tr> | 149 </tr> |
150 </tbody> | 150 </tbody> |
151 </table> | 151 </table> |
152 | 152 |
153 <p> | 153 <p> |
154 Here are some examples of <em>invalid</em> pattern matches: | 154 Here are some examples of <em>invalid</em> pattern matches: |
155 </p> | 155 </p> |
156 | 156 |
157 <table> | 157 <table> |
158 <tbody> | 158 <tbody> |
159 <tr> | 159 <tr> |
160 <th>Bad pattern</th> | 160 <th>Bad pattern</th> |
161 <th>Why it's bad</th> | 161 <th>Why it's bad</th> |
162 </tr> | 162 </tr> |
163 | 163 |
164 <tr> | 164 <tr> |
165 <td><code>http://*</code></td> | 165 <td><code>http://*</code></td> |
166 <td>No <em>path</em></td> | 166 <td>No <em>path</em></td> |
167 </tr> | 167 </tr> |
168 | 168 |
169 <tr> | 169 <tr> |
170 <td><code>http://*foo/bar</code></td> | 170 <td><code>http://*foo/bar</code></td> |
171 <td>'*' in the <em>host</em> can be followed only by a '.' or '/'</td> | 171 <td>'*' in the <em>host</em> can be followed only by a '.' or '/'</td> |
172 </tr> | 172 </tr> |
173 | 173 |
174 <tr> | 174 <tr> |
175 <td><code>http://foo.*.bar/baz </code></td> | 175 <td><code>http://foo.*.bar/baz </code></td> |
176 <td>If '*' is in the <em>host</em>, it must be the first character</td> | 176 <td>If '*' is in the <em>host</em>, it must be the first character</td> |
177 </tr> | 177 </tr> |
178 | 178 |
179 <tr> | 179 <tr> |
180 <td><code>http:/bar</code></td> | 180 <td><code>http:/bar</code></td> |
181 <td>Missing <em>scheme</em> separator ("/" should be "//")</td> | 181 <td>Missing <em>scheme</em> separator ("/" should be "//")</td> |
182 </tr> | 182 </tr> |
183 | 183 |
184 <tr> | 184 <tr> |
185 <td><code>foo://*</code></td> | 185 <td><code>foo://*</code></td> |
186 <td>Invalid <em>scheme</em></td> | 186 <td>Invalid <em>scheme</em></td> |
187 </tr> | 187 </tr> |
188 </tbody> | 188 </tbody> |
189 </table> | 189 </table> |
190 | 190 |
OLD | NEW |