OLD | NEW |
1 <div id="pageData-name" class="pageData">Web Requests</div> | |
2 | |
3 <!-- BEGIN AUTHORED CONTENT --> | |
4 <p id="classSummary"> | 1 <p id="classSummary"> |
5 Use the <code>chrome.webRequest</code> module to intercept, block, | 2 Use the <code>chrome.webRequest</code> module to intercept, block, |
6 or modify requests in-flight and to observe and analyze traffic. | 3 or modify requests in-flight and to observe and analyze traffic. |
7 </p> | 4 </p> |
8 | 5 |
9 <h2 id="manifest">Manifest</h2> | 6 <h2 id="manifest">Manifest</h2> |
10 <p>You must declare the "webRequest" permission in the <a | 7 <p>You must declare the "webRequest" permission in the <a |
11 href="manifest.html">extension manifest</a> to use the web request | 8 href="manifest.html">extension manifest</a> to use the web request |
12 API, along with <a href="manifest.html#permissions">host permissions</a> | 9 API, along with <a href="manifest.html#permissions">host permissions</a> |
13 for any hosts whose network requests you want to access. If you want to | 10 for any hosts whose network requests you want to access. If you want to |
(...skipping 14 matching lines...) Expand all Loading... |
28 | 25 |
29 <p> | 26 <p> |
30 The web request API defines a set of events that follow the life cycle of a web | 27 The web request API defines a set of events that follow the life cycle of a web |
31 request. You can use these events to observe and analyze traffic. Certain | 28 request. You can use these events to observe and analyze traffic. Certain |
32 synchronous events will allow you to intercept, block, or modify a request. | 29 synchronous events will allow you to intercept, block, or modify a request. |
33 </p> | 30 </p> |
34 | 31 |
35 <p> | 32 <p> |
36 The event life cycle for successful requests is illustrated here, followed by | 33 The event life cycle for successful requests is illustrated here, followed by |
37 event definitions:<br/> | 34 event definitions:<br/> |
38 <img src="../images/webrequestapi.png" | 35 <img src="{{static}}/images/webrequestapi.png" |
39 width="385" height="503" | 36 width="385" height="503" |
40 alt="Life cycle of a web request from the perspective of the webrequest API" | 37 alt="Life cycle of a web request from the perspective of the webrequest API" |
41 style="margin-left: auto; margin-right: auto; display: block"/> | 38 style="margin-left: auto; margin-right: auto; display: block"/> |
42 </p> | 39 </p> |
43 | 40 |
44 <p> | 41 <p> |
45 <dl> | 42 <dl> |
46 <dt><code>onBeforeRequest</code> (optionally synchronous)</dt> | 43 <dt><code>onBeforeRequest</code> (optionally synchronous)</dt> |
47 <dd>Fires when a request is about to occur. This event is sent before any TCP | 44 <dd>Fires when a request is about to occur. This event is sent before any TCP |
48 connection is made and can be used to cancel or redirect requests.</dd> | 45 connection is made and can be used to cancel or redirect requests.</dd> |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 break; | 289 break; |
293 } | 290 } |
294 } | 291 } |
295 return {requestHeaders: details.requestHeaders}; | 292 return {requestHeaders: details.requestHeaders}; |
296 }, | 293 }, |
297 {urls: ["<all_urls>"]}, | 294 {urls: ["<all_urls>"]}, |
298 ["blocking", "requestHeaders"]); | 295 ["blocking", "requestHeaders"]); |
299 </pre> | 296 </pre> |
300 | 297 |
301 <p> For more example code, see the <a href="samples.html#webrequest">web request | 298 <p> For more example code, see the <a href="samples.html#webrequest">web request |
302 samples</a>.</p> | 299 samples</a>.</p> |
303 <!-- END AUTHORED CONTENT --> | |
OLD | NEW |