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