• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!-- BEGIN AUTHORED CONTENT -->
2<p id="classSummary">
3Use the <code>experimental.webInspector.resources</code> module to retrieve the
4information about network resources displayed by DevTools' Network panel.
5</p><p>
6See <a href="experimental.webInspector.html">WebInspector API summary</a> for
7general introduction to using WebInspector API</a>.
8</p>
9
10<h2>Notes</h2>
11
12<p>
13Network resource information is represented in HTTP Archive format
14(<em>HAR</em>). The description of HAR is outside of scope of this document,
15please refer to
16<a href=
17"http://groups.google.com/group/http-archive-specification/web/har-1-2-spec">
18HAR v1.2 Specification</a>.
19</p><p>
20In terms of HAR, the <code>webInspector.resources.getHAR()</code> method
21returns entire <em>HAR log</em>, while
22<code>webInspector.resources.onFinish</code> event provides <em>HAR entry</em>
23as an argument to the event callback.
24</p>
25<p>Note that resource content is not provided as part of HAR for efficieny
26reasons. You may call resource's <code>getContent()</code> method to retrieve
27content.
28<p>Some resources may be missing in the array of entries returned by <code>
29getHAR()</code> in case WebInspector was opened after the page was loaded &mdash;
30reload the page to get all resources. In general, the list of resources returned
31by <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
35loaded:</p>
36
37<pre>
38experimental.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