| OLD | NEW |
| 1 <!-- BEGIN AUTHORED CONTENT --> | 1 <!-- BEGIN AUTHORED CONTENT --> |
| 2 <div id="pageData-name" class="pageData">chrome.experimental.devtools.network | 2 <div id="pageData-name" class="pageData">chrome.experimental.devtools.network |
| 3 API</div> | 3 API</div> |
| 4 <p id="classSummary"> | 4 <p id="classSummary"> |
| 5 Use the <code>chrome.experimental.devtools.network</code> module to retrieve | 5 Use the <code>chrome.experimental.devtools.network</code> module to retrieve |
| 6 the information about network requests displayed by DevTools' Network panel. | 6 the information about network requests displayed by the Developer Tools |
| 7 in the Network panel. |
| 7 </p><p> | 8 </p><p> |
| 8 See <a href="experimental.devtools.html">DevTools APIs summary</a> for | 9 See <a href="experimental.devtools.html">DevTools APIs summary</a> for |
| 9 general introduction to using Developer Tools APIs</a>. | 10 general introduction to using Developer Tools APIs</a>. |
| 10 </p> | 11 </p> |
| 11 | 12 |
| 12 <h2>Notes</h2> | 13 <h2>Overview</h2> |
| 13 | 14 |
| 14 <p> | 15 <p> |
| 15 Network requests information is represented in the HTTP Archive format | 16 Network requests information is represented in the HTTP Archive format |
| 16 (<em>HAR</em>). The description of HAR is outside of scope of this document, | 17 (<em>HAR</em>). The description of HAR is outside of scope of this document, |
| 17 please refer to <a href= | 18 please refer to <a href= |
| 18 "http://groups.google.com/group/http-archive-specification/web/har-1-2-spec"> | 19 "http://groups.google.com/group/http-archive-specification/web/har-1-2-spec"> |
| 19 HAR v1.2 Specification</a>. | 20 HAR v1.2 Specification</a>. |
| 20 </p><p> | 21 </p><p> |
| 21 In terms of HAR, the | 22 In terms of HAR, the |
| 22 <code>chrome.experimental.devtools.network.getHAR()</code> method returns | 23 <code>chrome.experimental.devtools.network.getHAR()</code> method returns |
| 23 entire <em>HAR log</em>, while | 24 entire <em>HAR log</em>, while |
| 24 <code>chrome.experimental.devtools.network.onRequestFinished</code> event | 25 <code>chrome.experimental.devtools.network.onRequestFinished</code> event |
| 25 provides <em>HAR entry</em> as an argument to the event callback. | 26 provides <em>HAR entry</em> as an argument to the event callback. |
| 26 </p> | 27 </p> |
| 27 <p>Note that request content is not provided as part of HAR for efficieny | 28 <p>Note that request content is not provided as part of HAR for efficieny |
| 28 reasons. You may call request's <code>getContent()</code> method to retrieve | 29 reasons. You may call request's <code>getContent()</code> method to retrieve |
| 29 content. | 30 content. |
| 30 <p>Some requests may be missing in the array of entries returned by <code> | 31 <p>If the Developer Tools window is opened after the page is loaded, |
| 31 getHAR()</code> in case Developer Tools window was opened after the page was | 32 some requests may be missing |
| 32 loaded — reload the page to get all requests. In general, the list of | 33 in the array of entries returned by <code>getHAR()</code>. |
| 33 requests returned by <code>getHAR()</code> should match that displayed by | 34 Reload the page to get all requests. |
| 35 In general, the list of |
| 36 requests returned by <code>getHAR()</code> should match that displayed in |
| 34 the Network panel. | 37 the Network panel. |
| 35 <h2 id="overview-examples">Examples</h2> | 38 <h2 id="overview-examples">Examples</h2> |
| 36 | 39 |
| 37 <p>The following code logs URLs of all images larger than 40KB as they are | 40 <p>The following code logs URLs of all images larger than 40KB as they are |
| 38 loaded:</p> | 41 loaded:</p> |
| 39 | 42 |
| 40 <pre> | 43 <pre> |
| 41 chrome.experimental.devtools.network.onRequestFinished.addListener( | 44 chrome.experimental.devtools.network.onRequestFinished.addListener( |
| 42 function(request) { | 45 function(request) { |
| 43 if (request.response.bodySize > 40*1024) | 46 if (request.response.bodySize > 40*1024) |
| 44 chrome.experimental.devtools.console.addMessage( | 47 chrome.experimental.devtools.console.addMessage( |
| 45 chrome.experimental.devtools.console.Severity.Warning, | 48 chrome.experimental.devtools.console.Severity.Warning, |
| 46 "Large image: " + request.request.url); | 49 "Large image: " + request.request.url); |
| 47 }); | 50 }); |
| 48 </pre> | 51 </pre> |
| 49 | 52 |
| 50 <p> | 53 <p> |
| 51 You can find more examples that use this API in | 54 You can find more examples that use this API in |
| 52 <a href="samples.html#devtools.network">Samples</a>. | 55 <a href="samples.html#devtools.network">Samples</a>. |
| 53 </p> | 56 </p> |
| 54 | 57 |
| 55 <!-- END AUTHORED CONTENT --> | 58 <!-- END AUTHORED CONTENT --> |
| OLD | NEW |