| OLD | NEW |
| 1 <p id="classSummary"> | 1 <p id="classSummary"> |
| 2 Use the <code>chrome.webRequest</code> module to intercept, block, | 2 Use the <code>chrome.webRequest</code> module to intercept, block, |
| 3 or modify requests in-flight and to observe and analyze traffic. | 3 or modify requests in-flight and to observe and analyze traffic. |
| 4 </p> | 4 </p> |
| 5 | 5 |
| 6 <h2 id="manifest">Manifest</h2> | 6 <h2 id="manifest">Manifest</h2> |
| 7 <p>You must declare the "webRequest" permission in the <a | 7 <p>You must declare the "webRequest" permission in the <a |
| 8 href="manifest.html">extension manifest</a> to use the web request | 8 href="manifest.html">extension manifest</a> to use the web request |
| 9 API, along with <a href="manifest.html#permissions">host permissions</a> | 9 API, along with <a href="declare_permissions.html">host permissions</a> |
| 10 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 |
| 11 use the web request API in a blocking fashion, you need to request | 11 use the web request API in a blocking fashion, you need to request |
| 12 the "webRequestBlocking" permission in addition. | 12 the "webRequestBlocking" permission in addition. |
| 13 For example:</p> | 13 For example:</p> |
| 14 <pre>{ | 14 <pre>{ |
| 15 "name": "My extension", | 15 "name": "My extension", |
| 16 ... | 16 ... |
| 17 <b>"permissions": [ | 17 <b>"permissions": [ |
| 18 "webRequest", | 18 "webRequest", |
| 19 "*://*.google.com" | 19 "*://*.google.com" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 <li>Pragma</li> | 112 <li>Pragma</li> |
| 113 <li>Proxy-Authorization</li> | 113 <li>Proxy-Authorization</li> |
| 114 <li>Proxy-Connection</li> | 114 <li>Proxy-Connection</li> |
| 115 <li>Transfer-Encoding</li> | 115 <li>Transfer-Encoding</li> |
| 116 </ul> | 116 </ul> |
| 117 </p> | 117 </p> |
| 118 | 118 |
| 119 <p> | 119 <p> |
| 120 The webRequest API only exposes requests that the extension has | 120 The webRequest API only exposes requests that the extension has |
| 121 permission to see, given its | 121 permission to see, given its |
| 122 <a href="manifest.html#permissions">host permissions</a>. | 122 <a href="declare_permissions.html">host permissions</a>. |
| 123 Moreover, only the following schemes are accessible: | 123 Moreover, only the following schemes are accessible: |
| 124 <code>http://</code>, | 124 <code>http://</code>, |
| 125 <code>https://</code>, | 125 <code>https://</code>, |
| 126 <code>ftp://</code>, | 126 <code>ftp://</code>, |
| 127 <code>file://</code>, or | 127 <code>file://</code>, or |
| 128 <code>chrome-extension://</code>. | 128 <code>chrome-extension://</code>. |
| 129 In addition, even certain requests with URLs using one of the above schemes | 129 In addition, even certain requests with URLs using one of the above schemes |
| 130 are hidden, e.g., | 130 are hidden, e.g., |
| 131 <code>chrome-extension://other_extension_id</code> where | 131 <code>chrome-extension://other_extension_id</code> where |
| 132 <code>other_extension_id</code> is not the ID of the extension to handle | 132 <code>other_extension_id</code> is not the ID of the extension to handle |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 return {requestHeaders: details.requestHeaders}; | 292 return {requestHeaders: details.requestHeaders}; |
| 293 }, | 293 }, |
| 294 {urls: ["<all_urls>"]}, | 294 {urls: ["<all_urls>"]}, |
| 295 ["blocking", "requestHeaders"]); | 295 ["blocking", "requestHeaders"]); |
| 296 </pre> | 296 </pre> |
| 297 | 297 |
| 298 <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 |
| 299 samples</a>.</p> | 299 samples</a>.</p> |
| OLD | NEW |