| 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 23 matching lines...) Expand all Loading... |
| 37 | 34 |
| 38 <p> | 35 <p> |
| 39 The web request API defines a set of events that follow the life cycle of a web | 36 The web request API defines a set of events that follow the life cycle of a web |
| 40 request. You can use these events to observe and analyze traffic. Certain | 37 request. You can use these events to observe and analyze traffic. Certain |
| 41 synchronous events will allow you to intercept, block, or modify a request. | 38 synchronous events will allow you to intercept, block, or modify a request. |
| 42 </p> | 39 </p> |
| 43 | 40 |
| 44 <p> | 41 <p> |
| 45 The event life cycle for successful requests is illustrated here, followed by | 42 The event life cycle for successful requests is illustrated here, followed by |
| 46 event definitions:<br/> | 43 event definitions:<br/> |
| 47 <img src="../images/webrequestapi.png" | 44 <img src="{{static}}/images/webrequestapi.png" |
| 48 width="385" height="503" | 45 width="385" height="503" |
| 49 alt="Life cycle of a web request from the perspective of the webrequest API" | 46 alt="Life cycle of a web request from the perspective of the webrequest API" |
| 50 style="margin-left: auto; margin-right: auto; display: block"/> | 47 style="margin-left: auto; margin-right: auto; display: block"/> |
| 51 </p> | 48 </p> |
| 52 | 49 |
| 53 <p> | 50 <p> |
| 54 <dl> | 51 <dl> |
| 55 <dt><code>onBeforeRequest</code> (optionally synchronous)</dt> | 52 <dt><code>onBeforeRequest</code> (optionally synchronous)</dt> |
| 56 <dd>Fires when a request is about to occur. This event is sent before any TCP | 53 <dd>Fires when a request is about to occur. This event is sent before any TCP |
| 57 connection is made and can be used to cancel or redirect requests.</dd> | 54 connection is made and can be used to cancel or redirect requests.</dd> |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 break; | 296 break; |
| 300 } | 297 } |
| 301 } | 298 } |
| 302 return {requestHeaders: details.requestHeaders}; | 299 return {requestHeaders: details.requestHeaders}; |
| 303 }, | 300 }, |
| 304 {urls: ["<all_urls>"]}, | 301 {urls: ["<all_urls>"]}, |
| 305 ["blocking", "requestHeaders"]); | 302 ["blocking", "requestHeaders"]); |
| 306 </pre> | 303 </pre> |
| 307 | 304 |
| 308 <p> For more example code, see the <a href="samples.html#webrequest">web request | 305 <p> For more example code, see the <a href="samples.html#webrequest">web request |
| 309 samples</a>.</p> | 306 samples</a>.</p> |
| 310 <!-- END AUTHORED CONTENT --> | |
| OLD | NEW |