| OLD | NEW |
| 1 <div id="pageData-name" class="pageData">WebRequest API</div> | 1 <div id="pageData-name" class="pageData">WebRequest API</div> |
| 2 | 2 |
| 3 <!-- BEGIN AUTHORED CONTENT --> | 3 <!-- BEGIN AUTHORED CONTENT --> |
| 4 <p id="classSummary"> | 4 <p id="classSummary"> |
| 5 Use the <code>chrome.experimental.webRequest</code> module to intercept, block, | 5 Use the <code>chrome.experimental.webRequest</code> module to intercept, block, |
| 6 or modify requests in-flight. This module is still very much experimental. For | 6 or modify requests in-flight. This module is still very much experimental. For |
| 7 information on how to use experimental APIs, see the | 7 information on how to use experimental APIs, see the |
| 8 <a href="experimental.html">chrome.experimental.* APIs</a> page. | 8 <a href="experimental.html">chrome.experimental.* APIs</a> page. |
| 9 </p> | 9 </p> |
| 10 | 10 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 {}, | 224 {}, |
| 225 ["blocking"]); | 225 ["blocking"]); |
| 226 </pre> | 226 </pre> |
| 227 | 227 |
| 228 <p>The following example achives the same goal in a more efficient way because | 228 <p>The following example achives the same goal in a more efficient way because |
| 229 requests that are not targeted to <code>www.evil.com</code> do not need to be | 229 requests that are not targeted to <code>www.evil.com</code> do not need to be |
| 230 passed to the extension:</p> | 230 passed to the extension:</p> |
| 231 <pre> | 231 <pre> |
| 232 chrome.experimental.webRequest.onBeforeRequest.addListener( | 232 chrome.experimental.webRequest.onBeforeRequest.addListener( |
| 233 function(details) { return {cancel: true}; }, | 233 function(details) { return {cancel: true}; }, |
| 234 {"*://www.evil.com/*"}, | 234 {urls: ["*://www.evil.com/*"]}, |
| 235 ["blocking"]); | 235 ["blocking"]); |
| 236 </pre> | 236 </pre> |
| 237 | 237 |
| 238 <p>The following example illustrates how the User-Agent header can be deleted | 238 <p>The following example illustrates how the User-Agent header can be deleted |
| 239 from all requests:</p> | 239 from all requests:</p> |
| 240 <pre> | 240 <pre> |
| 241 chrome.experimental.webRequest.onBeforeSendHeaders.addListener( | 241 chrome.experimental.webRequest.onBeforeSendHeaders.addListener( |
| 242 function(details) { | 242 function(details) { |
| 243 delete details.requestHeaders['User-Agent']; | 243 delete details.requestHeaders['User-Agent']; |
| 244 return {requestHeaders: details.requestHeaders}; | 244 return {requestHeaders: details.requestHeaders}; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // Use the frameUrl e.g. to selectively cancel requests. | 276 // Use the frameUrl e.g. to selectively cancel requests. |
| 277 // Attention: The frameUrl can be undefined in some cases. Requests may not | 277 // Attention: The frameUrl can be undefined in some cases. Requests may not |
| 278 // originate from a frame (e.g. requests from extensions or shared workers). | 278 // originate from a frame (e.g. requests from extensions or shared workers). |
| 279 }); | 279 }); |
| 280 | 280 |
| 281 chrome.windows.onRemoved.addListener( | 281 chrome.windows.onRemoved.addListener( |
| 282 function(windowId) {delete frameUrl[windowId];} | 282 function(windowId) {delete frameUrl[windowId];} |
| 283 ); | 283 ); |
| 284 </pre> | 284 </pre> |
| 285 <!-- END AUTHORED CONTENT --> | 285 <!-- END AUTHORED CONTENT --> |
| OLD | NEW |