| OLD | NEW |
| 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.html">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.html">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 { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 <dt><code>onSendHeaders</code></dt> | 51 <dt><code>onSendHeaders</code></dt> |
| 52 <dd>Fires after all extensions have had a chance to modify the request | 52 <dd>Fires after all extensions have had a chance to modify the request |
| 53 headers, and presents the final <a href="#life_cycle_footnote">(*)</a> | 53 headers, and presents the final <a href="#life_cycle_footnote">(*)</a> |
| 54 version. The event is triggered before the headers are sent to the network. | 54 version. The event is triggered before the headers are sent to the network. |
| 55 This event is informational and handled asynchronously. It does not allow | 55 This event is informational and handled asynchronously. It does not allow |
| 56 modifying or cancelling the request.</dd> | 56 modifying or cancelling the request.</dd> |
| 57 <dt><code>onHeadersReceived</code> (optionally synchronous)</dt> | 57 <dt><code>onHeadersReceived</code> (optionally synchronous)</dt> |
| 58 <dd>Fires each time that an HTTP(S) response header is received. Due | 58 <dd>Fires each time that an HTTP(S) response header is received. Due |
| 59 to redirects and authentication requests this can happen multiple times per | 59 to redirects and authentication requests this can happen multiple times per |
| 60 request. This event is intended to allow extensions to add, modify, and delete | 60 request. This event is intended to allow extensions to add, modify, and delete |
| 61 response headers, such as incoming Set-Cookie headers.</dd> | 61 response headers, such as incoming Set-Cookie headers. It also allows you to |
| 62 redirect the request.</dd> |
| 62 <dt><code>onAuthRequired</code> (optionally synchronous)</dt> | 63 <dt><code>onAuthRequired</code> (optionally synchronous)</dt> |
| 63 <dd>Fires when a request requires authentication of the user. This event can | 64 <dd>Fires when a request requires authentication of the user. This event can |
| 64 be handled synchronously to provide authentication credentials. Note that | 65 be handled synchronously to provide authentication credentials. Note that |
| 65 extensions may provide invalid credentials. Take care not to enter an infinite | 66 extensions may provide invalid credentials. Take care not to enter an infinite |
| 66 loop by repeatedly providing invalid credentials.</dd> | 67 loop by repeatedly providing invalid credentials.</dd> |
| 67 <dt><code>onBeforeRedirect</code></dt> | 68 <dt><code>onBeforeRedirect</code></dt> |
| 68 <dd>Fires when a redirect is about to be executed. A redirection can be | 69 <dd>Fires when a redirect is about to be executed. A redirection can be |
| 69 triggered by an HTTP response code or by an extension. This event is | 70 triggered by an HTTP response code or by an extension. This event is |
| 70 informational and handled asynchronously. It does not allow you to modify or | 71 informational and handled asynchronously. It does not allow you to modify or |
| 71 cancel the request. </dd> | 72 cancel the request. </dd> |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 293 } |
| 293 } | 294 } |
| 294 return {requestHeaders: details.requestHeaders}; | 295 return {requestHeaders: details.requestHeaders}; |
| 295 }, | 296 }, |
| 296 {urls: ["<all_urls>"]}, | 297 {urls: ["<all_urls>"]}, |
| 297 ["blocking", "requestHeaders"]); | 298 ["blocking", "requestHeaders"]); |
| 298 </pre> | 299 </pre> |
| 299 | 300 |
| 300 <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.html#webrequest">web request |
| 301 samples</a>.</p> | 302 samples</a>.</p> |
| OLD | NEW |