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