OLD | NEW |
1 <div id="pageData-name" class="pageData">Web Requests</div> | 1 <div id="pageData-name" class="pageData">Web Requests</div> |
2 | 2 |
3 <!-- BEGIN AUTHORED CONTENT --> | 3 <!-- BEGIN AUTHORED CONTENT --> |
4 <p id="classSummary"> | 4 <p id="classSummary"> |
5 Use the <code>chrome.webRequest</code> module to intercept, block, | 5 Use the <code>chrome.webRequest</code> module to intercept, block, |
6 or modify requests in-flight and to observe and analyze traffic. | 6 or modify requests in-flight and to observe and analyze traffic. |
7 </p> | 7 </p> |
8 | 8 |
9 <h2 id="manifest">Manifest</h2> | 9 <h2 id="manifest">Manifest</h2> |
10 <p>You must declare the "webRequest" permission in the <a | 10 <p>You must declare the "webRequest" permission in the <a |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 requests, this means that the status line and response headers are | 89 requests, this means that the status line and response headers are |
90 available. This event is informational and handled asynchronously. It does not | 90 available. This event is informational and handled asynchronously. It does not |
91 allow modifying or cancelling the request.</dd> | 91 allow modifying or cancelling the request.</dd> |
92 <dt><code>onCompleted</code></dt> | 92 <dt><code>onCompleted</code></dt> |
93 <dd>Fires when a request has been processed successfully.</dd> | 93 <dd>Fires when a request has been processed successfully.</dd> |
94 <dt><code>onErrorOccurred</code></dt> | 94 <dt><code>onErrorOccurred</code></dt> |
95 <dd>Fires when a request could not be processed successfully.</dd> | 95 <dd>Fires when a request could not be processed successfully.</dd> |
96 </dl> | 96 </dl> |
97 The web request API guarantees that for each request either | 97 The web request API guarantees that for each request either |
98 <code>onCompleted</code> or <code>onErrorOccurred</code> is fired as the final | 98 <code>onCompleted</code> or <code>onErrorOccurred</code> is fired as the final |
99 event. | 99 event with one exception: If a request is redirected to a <code>data://</code> |
| 100 URL, <code>onBeforeRedirect</code> is the last reported event. |
100 </p> | 101 </p> |
101 | 102 |
102 <p id="life_cycle_footnote">(*) Note that the web request API presents an | 103 <p id="life_cycle_footnote">(*) Note that the web request API presents an |
103 abstraction of the network stack to the extension. Internally, one URL request | 104 abstraction of the network stack to the extension. Internally, one URL request |
104 can be split into several HTTP requests (for example to fetch individual byte | 105 can be split into several HTTP requests (for example to fetch individual byte |
105 ranges from a large file) or can be handled by the network stack without | 106 ranges from a large file) or can be handled by the network stack without |
106 communicating with the network. For this reason, the API does not provide the | 107 communicating with the network. For this reason, the API does not provide the |
107 final HTTP headers that are sent to the network. For example, all headers that | 108 final HTTP headers that are sent to the network. For example, all headers that |
108 are related to caching are invisible to the extension.</p> | 109 are related to caching are invisible to the extension.</p> |
109 | 110 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 } | 282 } |
282 return {requestHeaders: details.requestHeaders}; | 283 return {requestHeaders: details.requestHeaders}; |
283 }, | 284 }, |
284 {urls: ["<all_urls>"]}, | 285 {urls: ["<all_urls>"]}, |
285 ["blocking", "requestHeaders"]); | 286 ["blocking", "requestHeaders"]); |
286 </pre> | 287 </pre> |
287 | 288 |
288 <p> For more example code, see the <a href="samples.html#webrequest">web request | 289 <p> For more example code, see the <a href="samples.html#webrequest">web request |
289 samples</a>.</p> | 290 samples</a>.</p> |
290 <!-- END AUTHORED CONTENT --> | 291 <!-- END AUTHORED CONTENT --> |
OLD | NEW |