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

Side by Side Diff: chrome/common/extensions/docs/templates/intros/webRequest.html

Issue 219213007: Remove .html extension from links (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
OLDNEW
1 <h2 id="manifest">Manifest</h2> 1 <h2 id="manifest">Manifest</h2>
2 <p>You must declare the "webRequest" permission in the <a 2 <p>You must declare the "webRequest" permission in the <a
3 href="manifest.html">extension manifest</a> to use the web request 3 href="manifest">extension manifest</a> to use the web request
4 API, along with <a href="declare_permissions.html">host permissions</a> 4 API, along with <a href="declare_permissions">host permissions</a>
5 for any hosts whose network requests you want to access. If you want to 5 for any hosts whose network requests you want to access. If you want to
6 use the web request API in a blocking fashion, you need to request 6 use the web request API in a blocking fashion, you need to request
7 the "webRequestBlocking" permission in addition. 7 the "webRequestBlocking" permission in addition.
8 For example:</p> 8 For example:</p>
9 <pre data-filename="manifest.json"> 9 <pre data-filename="manifest.json">
10 { 10 {
11 "name": "My extension", 11 "name": "My extension",
12 ... 12 ...
13 <b>"permissions": [ 13 <b>"permissions": [
14 "webRequest", 14 "webRequest",
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 <li>Pragma</li> 110 <li>Pragma</li>
111 <li>Proxy-Authorization</li> 111 <li>Proxy-Authorization</li>
112 <li>Proxy-Connection</li> 112 <li>Proxy-Connection</li>
113 <li>Transfer-Encoding</li> 113 <li>Transfer-Encoding</li>
114 </ul> 114 </ul>
115 </p> 115 </p>
116 116
117 <p> 117 <p>
118 The webRequest API only exposes requests that the extension has 118 The webRequest API only exposes requests that the extension has
119 permission to see, given its 119 permission to see, given its
120 <a href="declare_permissions.html">host permissions</a>. 120 <a href="declare_permissions">host permissions</a>.
121 Moreover, only the following schemes are accessible: 121 Moreover, only the following schemes are accessible:
122 <code>http://</code>, 122 <code>http://</code>,
123 <code>https://</code>, 123 <code>https://</code>,
124 <code>ftp://</code>, 124 <code>ftp://</code>,
125 <code>file://</code>, or 125 <code>file://</code>, or
126 <code>chrome-extension://</code>. 126 <code>chrome-extension://</code>.
127 In addition, even certain requests with URLs using one of the above schemes 127 In addition, even certain requests with URLs using one of the above schemes
128 are hidden, e.g., 128 are hidden, e.g.,
129 <code>chrome-extension://other_extension_id</code> where 129 <code>chrome-extension://other_extension_id</code> where
130 <code>other_extension_id</code> is not the ID of the extension to handle 130 <code>other_extension_id</code> is not the ID of the extension to handle
(...skipping 19 matching lines...) Expand all
150 150
151 <p>Each request is identified by a request ID. This ID is unique within a 151 <p>Each request is identified by a request ID. This ID is unique within a
152 browser session and the context of an extension. It remains constant during the 152 browser session and the context of an extension. It remains constant during the
153 the life cycle of a request and can be used to match events for the same 153 the life cycle of a request and can be used to match events for the same
154 request. Note that several HTTP requests are mapped to one web request in case 154 request. Note that several HTTP requests are mapped to one web request in case
155 of HTTP redirection or HTTP authentication.</p> 155 of HTTP redirection or HTTP authentication.</p>
156 156
157 <h3 id="subscription">Registering event listeners</h3> 157 <h3 id="subscription">Registering event listeners</h3>
158 158
159 <p>To register an event listener for a web request, you use a variation on the 159 <p>To register an event listener for a web request, you use a variation on the
160 <a href="events.html">usual <code>addListener()</code> function</a>. 160 <a href="events">usual <code>addListener()</code> function</a>.
161 In addition to specifying a callback function, 161 In addition to specifying a callback function,
162 you have to specify a filter argument and you may specify an optional extra info 162 you have to specify a filter argument and you may specify an optional extra info
163 argument.</p> 163 argument.</p>
164 164
165 <p>The three arguments to the web request API's <code>addListener()</code> have 165 <p>The three arguments to the web request API's <code>addListener()</code> have
166 the following definitions:</p> 166 the following definitions:</p>
167 <pre> 167 <pre>
168 var callback = function(details) {...}; 168 var callback = function(details) {...};
169 var filter = {...}; 169 var filter = {...};
170 var opt_extraInfoSpec = [...]; 170 var opt_extraInfoSpec = [...];
(...skipping 21 matching lines...) Expand all
192 cancelling or redirecting a request (<code>onBeforeRequest</code>), cancelling a 192 cancelling or redirecting a request (<code>onBeforeRequest</code>), cancelling a
193 request or modifying headers (<code>onBeforeSendHeaders</code>, 193 request or modifying headers (<code>onBeforeSendHeaders</code>,
194 <code>onHeadersReceived</code>), or providing authentication credentials 194 <code>onHeadersReceived</code>), or providing authentication credentials
195 (<code>onAuthRequired</code>).</p> 195 (<code>onAuthRequired</code>).</p>
196 196
197 <p>The $(ref:webRequest.RequestFilter) 197 <p>The $(ref:webRequest.RequestFilter)
198 <code>filter</code> allows limiting the requests for which events are 198 <code>filter</code> allows limiting the requests for which events are
199 triggered in various dimensions: 199 triggered in various dimensions:
200 <dl> 200 <dl>
201 <dt>URLs</dt> 201 <dt>URLs</dt>
202 <dd><a href="match_patterns.html">URL patterns</a> such as 202 <dd><a href="match_patterns">URL patterns</a> such as
203 <code>*://www.google.com/foo*bar</code>.</dd> 203 <code>*://www.google.com/foo*bar</code>.</dd>
204 <dt>Types</dt> 204 <dt>Types</dt>
205 <dd>Request types such as <code>main_frame</code> (a document that is loaded 205 <dd>Request types such as <code>main_frame</code> (a document that is loaded
206 for a top-level frame), <code>sub_frame</code> (a document that is loaded for 206 for a top-level frame), <code>sub_frame</code> (a document that is loaded for
207 an embedded frame), and <code>image</code> (an image on a web site). 207 an embedded frame), and <code>image</code> (an image on a web site).
208 See $(ref:webRequest.RequestFilter).</dd> 208 See $(ref:webRequest.RequestFilter).</dd>
209 <dt>Tab ID</dt> 209 <dt>Tab ID</dt>
210 <dd>The identifier for one tab.</dd> 210 <dd>The identifier for one tab.</dd>
211 <dt>Window ID</dt> 211 <dt>Window ID</dt>
212 <dd>The identifier for a window.</dd> 212 <dd>The identifier for a window.</dd>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 details.requestHeaders.splice(i, 1); 291 details.requestHeaders.splice(i, 1);
292 break; 292 break;
293 } 293 }
294 } 294 }
295 return {requestHeaders: details.requestHeaders}; 295 return {requestHeaders: details.requestHeaders};
296 }, 296 },
297 {urls: ["&lt;all_urls&gt;"]}, 297 {urls: ["&lt;all_urls&gt;"]},
298 ["blocking", "requestHeaders"]); 298 ["blocking", "requestHeaders"]);
299 </pre> 299 </pre>
300 300
301 <p> For more example code, see the <a href="samples.html#webrequest">web request 301 <p> For more example code, see the <a href="samples#webrequest">web request
302 samples</a>.</p> 302 samples</a>.</p>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698