Home | History | Annotate | Download | only in static
      1 <!-- BEGIN AUTHORED CONTENT -->
      2 <p id="classSummary">
      3 Use the <code>experimental.webInspector.resources</code> module to retrieve the
      4 information about network resources displayed by DevTools' Network panel.
      5 </p><p>
      6 See <a href="experimental.webInspector.html">WebInspector API summary</a> for
      7 general introduction to using WebInspector API</a>.
      8 </p>
      9 
     10 <h2>Notes</h2>
     11 
     12 <p>
     13 Network resource information is represented in HTTP Archive format
     14 (<em>HAR</em>). The description of HAR is outside of scope of this document,
     15 please refer to
     16 <a href=
     17 "http://groups.google.com/group/http-archive-specification/web/har-1-2-spec">
     18 HAR v1.2 Specification</a>.
     19 </p><p>
     20 In terms of HAR, the <code>webInspector.resources.getHAR()</code> method
     21 returns entire <em>HAR log</em>, while
     22 <code>webInspector.resources.onFinish</code> event provides <em>HAR entry</em>
     23 as an argument to the event callback.
     24 </p>
     25 <p>Note that resource content is not provided as part of HAR for efficieny
     26 reasons. You may call resource's <code>getContent()</code> method to retrieve
     27 content.
     28 <p>Some resources may be missing in the array of entries returned by <code>
     29 getHAR()</code> in case WebInspector was opened after the page was loaded &mdash;
     30 reload the page to get all resources. In general, the list of resources returned
     31 by <code>getHAR()</code> should match that displayed by the Network panel.
     32 <h2 id="overview-examples">Examples</h2>
     33 
     34 <p>The following code logs URLs of all images larger than 40KB as they are
     35 loaded:</p>
     36 
     37 <pre>
     38 experimental.webInspector.resources.onFinished.addListener(function(resource) {
     39   if (resource.response.bodySize > 40*1024)
     40     webInspector.log("Large image: " + resource.request.url);
     41 });
     42 </pre>
     43 
     44 <!-- END AUTHORED CONTENT -->
     45